[M3devel] test p078 works in release but not head -- NUMBER(open array constant) not constant

Jay K jay.krell at cornell.edu
Sun Mar 7 15:14:29 CET 2010


nevermind.

 

Index: Number.m3
===================================================================
RCS file: /usr/cvs/cm3/m3-sys/m3front/src/builtinOps/Number.m3,v
retrieving revision 1.5
diff -u -r1.5 Number.m3
--- Number.m3 18 Feb 2010 02:33:09 -0000 1.5
+++ Number.m3 7 Mar 2010 14:11:17 -0000
@@ -102,8 +102,8 @@
         IF ArrayExpr.GetBounds (e, min, max)
           AND TInt.Subtract (max, min, tmp)
           AND TInt.Add (tmp, TInt.One, num)
-          AND NOT TInt.LT (num, Target.Integer.max)
-          AND NOT TInt.LT (Target.Integer.max, num)
+          AND TInt.GE (num, Target.Integer.min)
+          AND TInt.LE (num, Target.Integer.max)
           THEN RETURN IntegerExpr.New (Int.T, num);
           ELSE RETURN NIL;
         END;


Notice how the full assortment of LE/GE/LT/GT/EQ/NE makes it
easier to read and write the code and get it correct. :)

 

Of course, the "double max" stands out as incorrect either way.

 

 - Jay





 


From: jay.krell at cornell.edu
To: hosking at cs.purdue.edu; m3devel at elegosoft.com
Date: Sun, 7 Mar 2010 13:37:28 +0000
Subject: [M3devel] test p078 works in release but not head -- NUMBER(open array constant) not constant



C:\dev2\cm3.2\m3-sys\m3tests\src\p0\p078
 
 
This compiles with release but not head.
 
 
(* Copyright (C) 1994, Digital Equipment Corporation. *)
(* All rights reserved.                               *)
(* See the file COPYRIGHT for a full description.     *)
 
MODULE Main;
FROM Test IMPORT done, checkI, checkB;
CONST
  Numbers = ARRAY OF INTEGER {2, 3, 5, 7, 11};
  First = Numbers [FIRST (Numbers)];
  Last = Numbers [LAST (Numbers)];

  Number = NUMBER (Numbers);
  Empty = ARRAY OF INTEGER {};
  EFirst = FIRST (Empty);
  ELast  = LAST (Empty);
  ENumber = NUMBER (Empty);
 
BEGIN
checkI (First, 2);
checkI (Last, 11);
checkI (Number, 5);
checkB (EFirst > ELast, TRUE);
checkI (ENumber, 0);
done ();
END Main.

 
new source -> compiling Main.m3
"..\Main.m3", line 14: value is not constant
"..\Main.m3", line 19: value is not constant
2 errors encountered
compilation failed => not building program "pgm.exe"
Fatal Error: package build failed
C:\dev2\cm3.2\m3-sys\m3tests\src\p0\p078>
 
 
It is the lines with "NUMBER".
 
 
 - Jay
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100307/f1a90c09/attachment-0002.html>


More information about the M3devel mailing list