[fpc-devel]Compiler bug

Johann Glaser Johann.Glaser at gmx.at
Mon Apr 28 21:25:08 CEST 2003


Hi!

I found a bug in the compiler. Please have a look at the attached
program.

The Procedure "DoWhat contains three variables, each with an "absolute"
statement.

The compiler accepts all these variable declarations without any error.
Even using "-va" doesn't print anything there.

But when using the variables MyRR and Field it complains:

[hansi at hansi]-(~)$ fpc FPC-Bug.pas 
Free Pascal Compiler version 1.0.6 [2002/08/10] for i386
Copyright (c) 1993-2002 by Florian Klaempfl
Target OS: Linux for i386
Compiling FPC-Bug.pas
FPC-Bug.pas(15,11) Error: Identifier not found MYRR
FPC-Bug.pas(15,16) Error: Illegal qualifier
FPC-Bug.pas(16,11) Error: Identifier not found FIELD
FPC-Bug.pas(25) Fatal: There were 3 errors compiling module, stopping
[hansi at hansi]-(~)$ 

Since "MyRR" and "Field" simply are "aliases" for the parameter, I think
this should be allowed. It can simplify programming a lot.

Would it be possible to get this working?

Thanks
  Hansi

-- 
Johann Glaser   <Johann.Glaser at gmx.at>
   Vienna University of Technology
       Electrical Engineering 
____ http://www.johann-glaser.at/ ____
-------------- next part --------------
Program FPCBug;

Type PRec = ^TRec;
     TRec = Record
       Field : Byte;
     End;

Procedure DoWhat(R:PRec);
Var MyR   : PRec absolute R;
    MyRR  : TRec absolute R^;        { <--- here no complaint }
    Field : Byte absolute R^.Field;  { <--- here no complaint }
Begin
  WriteLn(R^.Field);
  WriteLn(MyR^.Field);
  WriteLn(MyRR.Field);  { <--- here a complaint }
  WriteLn(Field);       { <--- here a complaint }
End;

Var R : TRec;

Begin
  R.Field := 12;
  DoWhat(@R);
End.


More information about the fpc-devel mailing list