Hi everyone!
I've got a number of bug reports. Perhaps some of them are already known, but I didn't find any information about them. I'm listing all the problems I encountered when I ported a BP program to gpc.
The bugs were tested with 2.0, and "verified" with 970221.
1. The output of a compiler program is not redirectable (neither as stdout, nor stderr).
2. Writeln('a','':5,'b'); I think it should write "a b", but it just writes "ab".
3. My standard way for "variable size arrays" in BP doesn't work in gpc:
PROGRAM t;
CONST MaxVar=$FFF0;
TYPE X=Integer;
XArray=ARRAY[1..MaxVar DIV SizeOf(X)] OF X; {}
BEGIN END.
The error message for the line "{}" is:
subrange bounds are not of the same type ordinal type expected
It doesn't depend on the type of X, and it doesn't help to declare a constant with value MaxVar DIV SizeOf(X).
4. Problem with CONST parameters:
PROGRAM x;
TYPE t=ARRAY[1..1] OF Integer;
PROCEDURE p(CONST c:t); BEGIN IF c[1]=0 THEN END;
BEGIN END.
gpc crashes with:
Exiting due to signal SIGSEGV Page fault at...
(I could provide all the register values if necessary.)
It doesn't matter if I invoce it as gpc x.p or gpc -o x x.p or gpc -c x.p
It doesn't seem to depend on the type of t (it must only be an array), and it doesn't matter if c[1] is accessed as above, or e.g. in a Write statement.
5. Initialized set variables don't seem to work:
PROGRAM t;
TYPE IByte=__byte__ Integer; Byte=__unsigned__ IByte; ByteSet=SET OF Byte;
VAR m:ByteSet VALUE [1,2,3]; {"CONST ... = ..." gives the same result} k:Integer; {or k:Byte - the same}
BEGIN { m:=[1,2,3]; ...then it works correctly } FOR k:=0 TO $FF DO IF k IN m THEN Write(Integer(k)) END.
The numbers written are more or less random.
6. Last but not least: Is there anything like TP's Exit (return from current procedure/function)? I couldn't find it in the docs.
Frank