[fpc-pascal]Bug with a record type?

James_Wilson at i2.com James_Wilson at i2.com
Mon Feb 19 18:29:45 CET 2001


I'm getting a strange error message from the win32 compiler (ver 1.0.4,
2000/12/30) in a spot that seems like it should be fine. Here's a code
snippet, which is just a couple of the more pertinent lines from the source
file:

const
  MAX_LINES    = 1000000;

type
  DataRecord   = packed record
                   Data    : string;
                   Display : boolean;
                   Actual  : longint;
                 end;

var
  CurrentLine : longint;
  TotalLines : longint;
  DataFromFile : array [1..MAX_LINES] of ^DataRecord;


for CurrentLine := 1 to TotalLines do
  if DataFromFile [CurrentLine].Display then
  begin
    {$I-}
      writeln (PrinterPort,DataFromFile [CurrentLine].Data);
    {$I+}
    if ioresult <> 0 then Error (201,FALSE,Port);
  end;


Note that the program in question is, counting units, over 150K of source
so I didn't attach it.  :-)  Also, all memory is assigned properly and the
elements of the records have already been filled by the time the program
gets to the above bit of code.

I'm getting two errors on the "if DataFromFile [CurrentLine].Display then"
line; "Error: illegal qualifier" and "Fatal: Syntax error, THEN expected
but identifier DISPLAY found".

Basically the line in question is just checking to see if the boolean from
the record (DataFromFile.Display) is TRUE or FALSE. If it's TRUE the line
is sent to the printer, otherwise it's ignored. To me that code looks okay,
but to FPC is doesn't. Oddly enough, if I try and compile it using VP it
compiles and runs fine.

So, did I find an FPC bug or am I doing something totally wrong here?  :-)

TIA...


Jim





More information about the fpc-pascal mailing list