According to Frank Heckenbach:
The following program causes an internal compiler error (Linux) or causes gpc to crash with page fault (DJGPP), sometimes it hangs.
Fixed.
Is "Integer(n)" supposed to support bigger types than LongestInt?
No. Somebody else may implement that ... ;-)
If not, gpc should give an error if n is too big,
It does so, now.
The following program writes 0. ("+" doesn't seem to work correctly with big integers at all, telling from the asm code.)
program x; var a:integer(128); begin a:=$FFFFFFFF; a:=a+1; writeln(integer(a)) end.
This is correct: "a + 1" gets the integer value $100000000 in this example; the cast to `Integer' yields an (uncatched)-: overflow and the correct value 0 for the lowest 32 bits.
The following program writes "garbage":
var x:cardinal(8); begin x:=31; writeln(x); end.
`x' gets the correct value, but writeln barfs on `cardinal(8)' types. Working on it.
With this one, gpc says "initializer element is not constant":
program x; var a:integer(128) value 0; begin end.
This was connected with the undetected overflow. (The maximal integer types have 64 bits on the PC).
At least "=" seems to work with these types, which would make "Cardinal(128)" usable for ClassIDs (I hope)... :-)
Sorry to have it taken out again! ;-)
Also, the n in "Integer(n)" seems to be handled modulo 256. If types >256 bits are not supported, an error should be given.
It is now.
Besides, I'm not too sure if "Integer(0)" is reasonable... ;-)
It's also catched now.
And now for something completely different... [...]
Working on that.
But apart from these things, a lot of bugs have disappeared! :-)
:-) Fein! That's what I hoped for.
Thanks for the bug report, and I am glad that there were not much more bugs. This give hope that gpc-2.1 can be released within the next months.
Tschuess,
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201] maintainer GNU Pascal [970624] - http://home.pages.de/~gnu-pascal/ [970125]