<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Word.Insert and Word.Extract with large constants fail appropriately, via check_hi.<BR>
I just checked. Long.Insert/Extract similar.<BR>
<BR>
- Jay<BR> <BR>
<HR id=stopSpelling>
From: jay.krell@cornell.edu<BR>To: hosking@cs.purdue.edu; jkrell@elego.de<BR>CC: m3commit@elegosoft.com<BR>Subject: RE: [M3commit] CVS Update: cm3<BR>Date: Wed, 10 Feb 2010 16:37:23 +0000<BR><BR>
<STYLE>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</STYLE>
Please look for "word." in the historical m3back, anything from a week or so ago, the release branch, any other release, etc.<BR>I know I get runtime errors for large shift counts, I haven't used insert/extract as much, but if they are broken, then they have probably been broken a long time, probably forever.<BR> <BR> - Jay<BR><BR> <BR>
<HR id=ecxstopSpelling>
From: jay.krell@cornell.edu<BR>To: hosking@cs.purdue.edu; jkrell@elego.de<BR>Date: Wed, 10 Feb 2010 16:31:28 +0000<BR>CC: m3commit@elegosoft.com<BR>Subject: Re: [M3commit] CVS Update: cm3<BR><BR>
<STYLE>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</STYLE>
I don't really allow Add/Subtract to overflow.<BR> In fact I didn't make that change. I removed the overflow in the test case.<BR> My work is actually finding code that depends on silent overflow.<BR> <BR>My usage follows historical usage.<BR>Even the change I did have, not sure it is still there, returned the correct "false".<BR> But after possible garbage produced (or the wraparound value))<BR> <BR> <BR>Realize that all my tint/tword code used to use word. There were no checks.<BR> <BR> <BR>Ok, some overflow I'm allowing is like here, so I must have kept a change in ToInt:<BR> <BR> IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN<BR> t.Err("immOp1: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm));<BR> END;<BR><BR> IF (NOT TInt.ToInt(imm, ins.imm)) AND (NOT TWord.LE(imm, Target.Word32.max)) THEN<BR> t.Err("movImmT: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(imm));<BR> END;<BR><BR> IF (NOT TInt.ToInt(src.imm, ins.imm)) AND (NOT TWord.LE(src.imm, Target.Word32.max)) THEN<BR> t.Err("pushOp: unable to convert immediate to INTEGER:" & Target.TargetIntToDiagnosticText(src.imm));<BR> END;<BR><BR>It really is around some type ambiguity.<BR>Is the value signed or unsigned?<BR>Maybe we need TWord.ToWord(Word.T)?<BR>I think that is the simple answer really. Overflow checking good, no need to proceed with an answer, as long as we have a variant for conversion to 0..2^n. For now TInt.ToInt is what I use, a bit off.<BR> <BR> - Jay<BR><BR> <BR>
<HR id=ecxecxstopSpelling>
From: hosking@cs.purdue.edu<BR>Date: Wed, 10 Feb 2010 10:18:24 -0500<BR>To: jkrell@elego.de<BR>CC: m3commit@elegosoft.com<BR>Subject: Re: [M3commit] CVS Update: cm3<BR><BR>Jay, I think your usage of TInt and TWord is strongly at odds with its intended use. Certainly, allowing TInt.Add/Subtract to overflow will break large swaths of the front-end. There is a deep contract there that requires that TInt arithmetic not provide bogus results.
<DIV><BR></DIV>
<DIV><BR>
<DIV><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxecxApple-style-span>
<DIV style="WORD-WRAP: break-word"><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxecxApple-style-span>
<DIV><FONT class=ecxecxecxApple-style-span color=#0000ff><FONT class=ecxecxecxApple-style-span face="Gill Sans"><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxecxecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxecxecxApple-style-span>Antony Hosking</SPAN></SPAN></FONT></FONT><FONT class=ecxecxecxApple-style-span face="Gill Sans"><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxecxecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxecxecxApple-style-span><SPAN class=ecxecxecxApple-converted-space> </SPAN>|<SPAN class=ecxecxecxApple-converted-space> </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxecxecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxecxecxApple-style-span>Associate Professor</SPAN></SPAN><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxecxecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'" class=ecxecxecxApple-style-span> | Computer Science | Purdue University</SPAN></SPAN></FONT></DIV>
<DIV><FONT class=ecxecxecxApple-style-span face=GillSans-Light><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxecxecxApple-style-span>305 N. University Street | West Lafayette | IN 47907 | USA</SPAN></FONT></DIV>
<DIV><FONT class=ecxecxecxApple-style-span color=#0000ff face="Gill Sans"><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxecxecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxecxecxApple-style-span>Office</SPAN></SPAN></FONT><FONT class=ecxecxecxApple-style-span face=GillSans-Light><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxecxecxApple-style-span><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxecxecxApple-style-span> +1 765 494 6001 |<SPAN class=ecxecxecxApple-converted-space> </SPAN></SPAN></SPAN></FONT><FONT class=ecxecxecxApple-style-span color=#0000ff face="Gill Sans"><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxecxecxApple-style-span><SPAN style="FONT-FAMILY: 'Gill Sans'; COLOR: rgb(0,0,255)" class=ecxecxecxApple-style-span>Mobile</SPAN></SPAN></FONT><FONT class=ecxecxecxApple-style-span face=GillSans-Light><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxecxecxApple-style-span><SPAN style="FONT-FAMILY: GillSans-Light" class=ecxecxecxApple-style-span><SPAN class=ecxecxecxApple-converted-space> </SPAN>+1 765 427 5484</SPAN></SPAN></FONT></DIV>
<DIV><FONT class=ecxecxecxApple-style-span face=GillSans-Light><BR class=ecxecxecxkhtml-block-placeholder></FONT></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN><BR class=ecxecxecxApple-interchange-newline></SPAN></DIV></SPAN></SPAN><BR class=ecxecxecxApple-interchange-newline></DIV><BR>
<DIV>
<DIV>On 10 Feb 2010, at 12:58, Jay Krell wrote:</DIV><BR class=ecxecxecxApple-interchange-newline>
<BLOCKQUOTE>
<DIV>CVSROOT:<SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span> </SPAN>/usr/cvs<BR>Changes by:<SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span> </SPAN>jkrell@birch.<SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span> </SPAN>10/02/10 12:58:11<BR><BR>Modified files:<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>cm3/m3-sys/m3back/src/: Stackx86.m3 <BR><BR>Log message:<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>allow negating FIRST(INTEGER) even though it overflows<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>allows this test case to compile:<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>C:\dev2\cm3.2\m3-sys\m3tests\src\p1\p137>cm3<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>--- building in NT386 ---<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN><BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>new source -> compiling Main.m3<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>"..\Main.m3", line 35: doneg: Negate overflowed<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>1 error encountered<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>compilation failed => not building program "pgm.exe"<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>Fatal Error: package build failed<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN><BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>tempting to make TInt.Add/Subtract return the value<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>even if overflow, but for now, no.<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>This fix assumes two's complement, that is,<BR><SPAN style="WHITE-SPACE: pre" class=ecxecxecxApple-tab-span></SPAN>it assumes FIRST(INTEGER) = -FIRST(INTEGER)<BR></DIV></BLOCKQUOTE></DIV><BR></DIV> </body>
</html>