[fpc-devel] Bug while evaluating macros

Gerhard Scholz gs at g--s.de
Thu Jul 28 11:45:27 CEST 2005

I have tried to put this into the bug list but got an error message (I have
put that error into the buglist: bug# 4228), so I have to put it in the
mailing list, sorry.

Bug while evaluating macros:

Compilerversion of 25.7.2005 has error (18.7.2005 works!)

{$note hello1}
{$if sizeof ( integer ) = 2 }
  {$ifdef BCDgr4 }
                                    myMinIntBCD : tBCD ;
{$note hello2}
  {$if sizeof ( integer ) = 4 }
{$note hello2a}
    {$ifdef BCDgr9 }
{$note hello2b}
                                    myMinIntBCD : tBCD ;
    {$if sizeof ( integer ) = 8 }
      {$ifdef BCDgr18 }
                                    myMinIntBCD : tBCD ;
      {$fatal You have an interesting integer type! Sorry, not supported}
{$note hello3}

The sizeof ( integer ) = 4 produces the error:

22:55:40 P:\FmtBCD>ppc386 -al -Croit -Cs700000         -Op1 fmtbcdgs
Free Pascal Compiler version 2.1.1 [2005/07/25] for i386
Copyright (c) 1993-2005 by Florian Klaempfl
Note: Switching assembler to default source writing assembler
Target OS: Win32 for i386
Compiling fmtbcdgs.pas
fmtbcdgs.pas(10,66) Warning: Comment level 2 found
fmtbcdgs.pas(13,6) Warning: Comment level 2 found
fmtbcdgs.pas(13,46) Warning: Comment level 2 found
fmtbcdgs.pas(52,3) Note: User defined: BCD Digits > 4
fmtbcdgs.pas(56,3) Note: User defined: BCD Digits > 9
fmtbcdgs.pas(60,3) Note: User defined: BCD Digits > 18
fmtbcdgs.pas(64,3) Note: User defined: BCD Digits > 64
fmtbcdgs.pas(68,3) Note: User defined: BCD Digits > 180
fmtbcdgs.pas(192,4) Note: User defined: ansi
fmtbcdgs.pas(807,3) Warning: Comment level 2 found
fmtbcdgs.pas(808,3) Warning: Comment level 2 found
fmtbcdgs.pas(963,2) Note: User defined: hello1
fmtbcdgs.pas(970,2) Note: User defined: hello2
fmtbcdgs.pas(971,7) Fatal: Compilation aborted
An unhandled exception occurred at $00421661 :
EAccessViolation : Access violation
  $00421661  SEARCHSYM,  line 1833 of symtable.pas
  $00476FDC  READ_FACTOR,  line 580 of scanner.pas
  $00476A8B  READ_TERM,  line 739 of scanner.pas
  $0047695B  READ_SIMPLE_EXPR,  line 764 of scanner.pas
  $00476543  READ_EXPR,  line 790 of scanner.pas
  $004764E8  PARSE_COMPILER_EXPR,  line 843 of scanner.pas
  $00477951  BOOLEAN_COMPILE_TIME_EXPR,  line 850 of scanner.pas
  $00479AE5  TSCANNERFILE__IFPREPROCSTACK,  line 1674 of scanner.pas
  $004779BB  DIR_IF,  line 857 of scanner.pas
  $00479E22  TSCANNERFILE__HANDLECONDITIONAL,  line 1756 of scanner.pas
  $0047A1ED  TSCANNERFILE__HANDLEDIRECTIVES,  line 1849 of scanner.pas
  $0047AD59  TSCANNERFILE__SKIPCOMMENT,  line 2349 of scanner.pas
  $0047B071  TSCANNERFILE__READTOKEN,  line 2492 of scanner.pas
  $004852F4  CONSUME,  line 137 of pbase.pas
  $0048F674  READ_PROC,  line 1284 of psub.pas
  $0048FA22  READ_DECLARATIONS,  line 1374 of psub.pas
  $0048CCA8  BLOCK,  line 161 of psub.pas

I assume it has something to do with the withsymtable (weren't there

I was not able to construct a short example; when I shortened to a simple
example it did work. So the full code can be found on
http://g--s.de/pas/fmtbcdgs.pas (sorry, 112 kB!)

Solution for the moment: to go back to the FPC version of 18.7.2005

More information about the fpc-devel mailing list