[fpc-devel]Three bugs in 1.9.4 [2004/05/30] for powerpc (Darwin)

Tom Verhoeff T.Verhoeff at tue.nl
Thu Jun 3 22:16:32 CEST 2004


I installed the 1.9.4 version under Mac OS X tonight.  It fails to compile
some of my sources that worked fine with 1.9.3 (Mac OS X) and with 1.0.10
(Red Hat).

I was able to cut down the source to the following three problems.

Bug 1
--- -
program RangeCheck;

var
  c : Cardinal;

begin
  c := 1
; writeln ( c )
end.

When compiling this, I get

$ fpc -l -vwn rangecheck
Free Pascal Compiler version 1.9.4 [2004/05/30] for powerpc
Copyright (c) 1993-2004 by Florian Klaempfl
Target OS: Darwin for PowerPC
Compiling rangecheck.pp
rangecheck.pp(7,8) Warning: range check error while evaluating constants
Assembling rangecheck
Linking rangecheck
9 Lines compiled, 0.2 sec

The resulting program runs fine (writing 1).
The warning is not given by 1.9.3 [2004/04/08] for powerpc.
When including the option -Cr (range checking), the compile even fails
(which was to be expected from the previous warning):

$ fpc -l -vwn -Cr rangecheck
Free Pascal Compiler version 1.9.4 [2004/05/30] for powerpc
Copyright (c) 1993-2004 by Florian Klaempfl
Target OS: Darwin for PowerPC
Compiling rangecheck.pp
rangecheck.pp(7,8) Error: range check error while evaluating constants
rangecheck.pp(10) Fatal: There were 1 errors compiling module, stopping

Again, 1.9.3 [2004/04/08] for powerpc compiles without problem.

Something happened to Cardinal in 1.9.4.  This is unfortunate, because
many of my programs use Cardinal, and I strongly believe in range
checking (so I don't want to switch it off).

Bug 2
--- -
program CharByte;

var
  c : Char;

begin
  writeln ( 'Type a character: ' )
; readln ( c )
; if c in [ 'T', 'V' ] then
    writeln ( 'One of my favorite characters' )
  else
    writeln ( 'Sorry' )
end.

Here, I get:

$ fpc -l -vwn charbyte
Free Pascal Compiler version 1.9.4 [2004/05/30] for powerpc
Copyright (c) 1993-2004 by Florian Klaempfl
Target OS: Darwin for PowerPC
Compiling charbyte.pp
charbyte.pp(9,6) Error: Incompatible types: got "Char" expected "Byte"
charbyte.pp(14) Fatal: There were 1 errors compiling module, stopping

Again, 1.9.3 compiles it fine.

N.B. If the set is changed to [ 'T' .. 'T', 'V' .. 'V' ], the
1.9.4 compiles it fine.

Bug 3
--- -
program RangeError;

var
  c : 0 .. 169;

begin
  c := 100
; writeln ( c )
end.

Compile (fine) and run yield:

$ fpc -l -vwn -gl -Cr rangeerror.pp 
Free Pascal Compiler version 1.9.4 [2004/05/30] for powerpc
Copyright (c) 1993-2004 by Florian Klaempfl
Target OS: Darwin for PowerPC
Compiling rangeerror.pp
Assembling rangeerror
Linking rangeerror
9 Lines compiled, 0.2 sec
$ ./rangeerror 
Runtime error 201 at $00020AD8
  $00020AD8
  $000207A4
  $00002738
  $8FE1A58C

Unfortunately, the runtime error does not produce a complete stack dump
with line numbers.  (That hardly matters in such a small program,
but is horrendous when there are thousands of lines of source code).

Compiling withou range checking and running write the expected 100.

	Tom
-- 
E-MAIL: T.Verhoeff @ TUE.NL     | Fac. of Math. & Computing Science
PHONE:  +31 40 247 41 25        | Eindhoven University of Technology
FAX:    +31 40 247 54 04        | PO Box 513, NL-5600 MB Eindhoven
http://www.win.tue.nl/~wstomv/  | The Netherlands




More information about the fpc-devel mailing list