<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Nur Text Zchn";
margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.NurTextZchn
{mso-style-name:"Nur Text Zchn";
mso-style-priority:99;
mso-style-link:"Nur Text";
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=DE-CH link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoPlainText><span lang=EN-US>Hi all<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>I think ORG.Set*(VAR x, y: Item) is the culprit.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>Currently, in the end it is<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US> IF x.mode = ORB.Const THEN<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US> IF x.a # 0 THEN Put1(Xor, y.r, y.r, -1); Put1a(And, RH-1, y.r, x.a) END ;<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US> </span>x.mode := Reg; <span style='color:red'>x.r := RH-1</span><o:p></o:p></p><p class=MsoPlainText> <span lang=EN-US>ELSE DEC(RH); Put0(Ann, RH-1, x.r, y.r)<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US> END<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>But is should be<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US> IF x.mode = ORB.Const THEN<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US> IF x.a # 0 THEN Put1(Xor, y.r, y.r, -1); Put1a(And, RH-1, y.r, x.a) END ;<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US> </span>x.mode := Reg;<o:p></o:p></p><p class=MsoPlainText><span lang=EN-US> ELSE DEC(RH); Put0(Ann, RH-1, x.r, y.r)<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US> END;<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US> <span style='color:red'>x.r := RH-1</span><o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>br<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>Jörg<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=DE>Am 29.07.20, 18:03 schrieb "Oberon im Auftrag von Hellwig Geisse" <oberon-bounces@lists.inf.ethz.ch im Auftrag von hellwig.geisse@mni.thm.de>:<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE><o:p> </o:p></span></p><p class=MsoPlainText><span lang=DE> Michael,<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE><o:p> </o:p></span></p><p class=MsoPlainText><span lang=DE> On Mi, 2020-07-29 at 17:08 +0200, Michael Schierl wrote:<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > <o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > PROCEDURE SetDiff(a, b:SET): SET;<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > BEGIN<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > RETURN a - b<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > END SetDiff;<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > <o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > PROCEDURE Mask1(a, b: INTEGER): INTEGER;<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > BEGIN<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > RETURN SYSTEM.VAL(INTEGER, SetDiff(SYSTEM.VAL(SET, a), {b .. b + 7}))<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > END Mask1;<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > <o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > PROCEDURE Mask2(a, b: INTEGER): INTEGER;<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > BEGIN<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > RETURN SYSTEM.VAL(INTEGER, SYSTEM.VAL(SET, a) - {b .. b + 7})<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > END Mask2;<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> > <o:p></o:p></span></p><p class=MsoPlainText><span lang=DE><o:p> </o:p></span></p><p class=MsoPlainText><span lang=DE> this seems to be an erroneous translation of the set difference<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> operator, as far as I can see. This operator essentially gets<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> compiled to an "and negated" (ANN) instruction. The instruction<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> sequence for SetDiff is correct, it ends with "ANN R0,R0,R1"<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> (result in R0, a in R0, b in R1). But the instruction sequence<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> for Mask2 ends with "ANN R0,R1,R1", which yields 0 in R0<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> independent of the value in R1. The correct sequence should be<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> "ANN R0,R1,R0". I explored this with Andreas' Extended Oberon<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> compiler.<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE><o:p> </o:p></span></p><p class=MsoPlainText><span lang=DE> Hellwig<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> --<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems<o:p></o:p></span></p><p class=MsoPlainText><span lang=DE> https://lists.inf.ethz.ch/mailman/listinfo/oberon<o:p></o:p></span></p></div></body></html>