Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2004-06

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

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tom Verhoeff

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

Reply by email

Jonas Maebe
to Tom Verhoeff
Tom Verhoeff wrote 5 lines
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).

It's very strange. I can reproduce them with the official 1.9.4 release, but not with another 1.9.4 compiler I still have here (which was even compiled with register variables and optimizations turned on, as opposed to only optimizations for the release version).

Anyway, I already made a 1.9.5 installer package for someone else in the mean time (because of ar serious bug I fixed after 1.9.4 was released -- a bug which was also in 1.9.3). You can download it from http://www.elis.ugent.be/~jmaebe/nobackup/fpc/fpc-macosx-1.9.5.dmg

That one seems to work fine.

Jonas

Reply by email