[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gm2] gm2 errors
From: |
Iztok Kobal |
Subject: |
[Gm2] gm2 errors |
Date: |
Thu, 30 Jan 2003 23:55:16 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 |
Here are some compiler errors which I found with the latest gm2 checkin.
1. Double variable definition
MODULE test1;
VAR r : RECORD
c8 : [0..255];
c16 : [0..65535];
c32 : CARDINAL;
END;
r : REAL;
BEGIN
r.c16 := r.c8;
r.c32 := r.c16;
r := 5.0;
END test1.
gm2 -c -I. -g3 -gstabs+ -save-temps test1.mod
../../../gm2-20021105+gcc-3.2/gcc/gm2/gm2-compiler/SymbolTable.mod:2149:array
index out of bounds
Should say "Duplicate variable"
2. Type conversion
MODULE test2;
VAR
r : REAL;
BEGIN
r := 5;
END test2.
gm2 -c -I. -g3 -gstabs+ -save-temps test2.mod
test2.mod: In function `_M2_test1_init':
test2.mod:8: Internal compiler error in convert_move, at expr.c:502
Should say "Invalid type conversion"
3. Range checks
MODULE test3;
VAR
n : CARDINAL;
i : INTEGER;
BEGIN
n := MIN(INTEGER);
i : = MAX(CARDINAL);
END test3.
.LM2:
movl $-2147483648, n
.stabn 68,0,10,.LM3-_M2_test3_init
.LM3:
movl $2147483647, i
.stabn 68,0,12,.LM4-_M2_test3_init
gm2 -c -I. -g3 -gstabs+ -save-temps test3.mod
* Exits wrongly without fail. Here should be made compiletime range
check since there is no runtime one either !
** MAX(CARDINAL) is wrongly interpreted as MAX(INTEGER). Am I wrong or
CARDINAL should be 2^(BITS_PER_PROCESSORWORD or at least 16 for 8 bit
micros)-1 both in PIM2 and ISO ?
4. Using builtin functions with constants
MODULE test4;
CONST
N = MAX(CARDINAL);
VAR
n : CARDINAL;
BEGIN
n := N;
END test4.
gm2 -c -I. -g3 -gstabs+ -save-temps test4.mod
test4.mod:4:syntax error, found `('
test4.mod:4:syntax error, `;' missing
test4.mod:4:syntax error, found `)'
test4.mod:4:syntax error, `=' missing
test4.mod:6:expecting one of: __ATTRIBUTE__ NOT ( string real number
integer number identifier { - +
:0:compilation failed
Quite the same happens with all builtin functions (MIN, MAX, SIZE,
TSIZE, ...). You allow their (limited - see above) usage with variables
but not with constants.
5. Using SIZE with types
MODULE test5;
FROM SYSTEM IMPORT SIZE;
VAR
n : CARDINAL;
BEGIN
n := SIZE(INTEGER);
END test5.
gm2 -c -I. -g3 -gstabs+ -save-temps test5.mod
../../../gm2-20021105+gcc-3.2/gcc/gm2/gm2-compiler/SymbolTable.mod:6273:array
index out of bounds
It is false syntax for PIM2 but legal for ISO
Regards, Iztok
--
Your favorite stores, helpful shopping tools and great gift ideas.
Experience the convenience of buying online with address@hidden
http://shopnow.netscape.com/
- [Gm2] gm2 errors,
Iztok Kobal <=