I did some further investigations on the gpc issue I recently discovered on Mac OS X 10.4.10 PowerPC (gpc 20070904, based on gcc-4.1.2). The following program exhibits the problem:
program schorn3;
type abc = record a, b, c: Extended; end; const d = 22092007.192016;
procedure outer; var x: abc;
procedure inner(p: abc); begin if x.a = d then writeln('OK') else writeln('Fail. Got x.a = ', x.a, '. Expected x.a =', d); end;
begin { outer } x.a := d; inner(x); end;
begin outer; end.
The following behavior is observed: peter% /Developer/Pascal/gpc412/bin/gpc -o schorn3 schorn3.pas peter% schorn3 Fail. Got x.a = -3.066700750256657e-231. Expected x.a = 2.209200719201600e+07
Now with --pack-struct (although it seems there is nothing to pack) peter% /Developer/Pascal/gpc412/bin/gpc --pack-struct -o schorn3 schorn3.pas peter% schorn3 OK
The previous test program for this issue caused bus errors or segmentation faults on Macintoshes but also had a chance to succeed by chance (only a boolean at a possibly wrong address was tested). Maybe the issue now shows up on other platforms as well.
Peter ----- peter.schorn at acm.org
Sorry to follow up on my own post but I haven't seen any response. Simple question: Is the program below working on non-Apple platforms?
Thanks and best regards, Peter
Peter Schorn wrote:
I did some further investigations on the gpc issue I recently discovered on Mac OS X 10.4.10 PowerPC (gpc 20070904, based on gcc-4.1.2). The following program exhibits the problem:
program schorn3;
type abc = record a, b, c: Extended; end; const d = 22092007.192016;
procedure outer; var x: abc;
procedure inner(p: abc); begin if x.a = d then writeln('OK') else writeln('Fail. Got x.a = ', x.a, '. Expected x.a =', d); end;
begin { outer } x.a := d; inner(x); end;
begin outer; end.
The following behavior is observed: peter% /Developer/Pascal/gpc412/bin/gpc -o schorn3 schorn3.pas peter% schorn3 Fail. Got x.a = -3.066700750256657e-231. Expected x.a = 2.209200719201600e+07
Now with --pack-struct (although it seems there is nothing to pack) peter% /Developer/Pascal/gpc412/bin/gpc --pack-struct -o schorn3 schorn3.pas peter% schorn3 OK
The previous test program for this issue caused bus errors or segmentation faults on Macintoshes but also had a chance to succeed by chance (only a boolean at a possibly wrong address was tested). Maybe the issue now shows up on other platforms as well.
Peter
peter.schorn at acm.org
Peter Schorn a écrit:
Sorry to follow up on my own post but I haven't seen any response. Simple question: Is the program below working on non-Apple platforms?
No problem on DJGPP with gpc20070904 / gcc 4.1.2
Maurice
On Wed, 26 Sep 2007, Peter Schorn wrote:
Sorry to follow up on my own post but I haven't seen any response. Simple question: Is the program below working on non-Apple platforms?
Yes. On linux i686 results: OK
Using built-in specs. Configured with: ../gcc-4.1.2/configure --prefix=/usr --enable-shared --enable-languages=c,c++,pascal --enable-threads=posix --enable-__cxa_atexit Thread model: posix gpc version 20070904, based on gcc-4.1.2
Hope this helps Russ
Peter Schorn wrote:
Sorry to follow up on my own post but I haven't seen any response. Simple question: Is the program below working on non-Apple platforms?
It's the same problem as before. You can workaround this Apple-specific compiler-bug by passing --maximum-field-alignment=32 (but --maximum-field-alignment=64 and --maximum-field-alignment=128 crash also).
I think we should report it (in the form of an equivalent C-program) as a bug to http://gcc.gnu.org/bugzilla/.
Regards,
Adriaan van Os
I think we should report it (in the form of an equivalent C-program) as a bug to http://gcc.gnu.org/bugzilla/.
Regards,
Adriaan van Os
I have written a small C program showing the bug and reported it (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33610).
Best regards, Peter
On Oct 1, 2007, at 9:20 AM, Peter Schorn wrote:
I think we should report it (in the form of an equivalent C- program) as a bug to http://gcc.gnu.org/bugzilla/. Regards, Adriaan van Os
I have written a small C program showing the bug and reported it (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33610).
Any particular reason you reported the bug against gcc version 4.2.1?
It has been gcc version 4.1.2 that we've been using as the gcc version base for Mac OS X build and testing of gpc 20070904.
(See your 22 Sep 2007 posting starting this thread <http://www.gnu- pascal.de/crystal/gpc/en/mail14151.html>, quote:
"... Mac OS X 10.4.10 PowerPC (gpc 20070904, based on gcc-4.1.2)." )
Gale Paeper gpaeper@empirenet.com
Peter Schorn wrote:
I have written a small C program showing the bug and reported it (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33610).
Thanks for the bug report !
Gale Paeper wrote:
It has been gcc version 4.1.2 that we've been using as the gcc version base for Mac OS X build and testing of gpc 20070904.
(See your 22 Sep 2007 posting starting this thread http://www.gnu-pascal.de/crystal/gpc/en/mail14151.html, quote:
"... Mac OS X 10.4.10 PowerPC (gpc 20070904, based on gcc-4.1.2)."
It looks like gcc-4.2.1 (and Apple-gcc-4.0.1) only fail on powerpc-apple-darwin (not on i386-apple-darwin), whereas gcc-4.1.2 also fails on i386-apple-darwin. I have added appropriate comments to the bug report.
Regards,
Adriaan van Os