[fpc-devel]Another FPC versus Delphi issue

Tom Verhoeff wstomv at win.tue.nl
Thu Oct 11 10:07:21 CEST 2001

While using FreePascal in our Programming Education and Contest Hosting
system (PEACH), we encountered another issue.  Consider this program
(students try strange things):

program LongArray;

  a: array [ Integer ] of Integer;
  i: Integer;


  for i := 0 to 1000 do begin
    a [ i ] := i
  end { for i }

; writeln ( a [ 1000 ] )

Under Delphi (v5) this gives an compile-time error (Data type too
large:  exceeds 2GB).  Under fpc 1.0.4 it works without options
(Integer is 16 bit), and crashes with option -Sd (Delphi mode, Integer
is 32 bit): Segmentation fault.  Also fpc 1.1 made it crash.  By the
way, WITHOUT option -gl (to get more extensive runtime error info), the
crash is "silent", and you can only see it when you examine the exit
status, which is 103 (file not open!?) or 139 when using option -Cr
(range checking).

It seems to me that fpc should give a compile-time error, rather
than crash.

	Tom Verhoeff

More information about the fpc-devel mailing list