On Wed, 19 Sep 2007, Waldek Hebisch wrote:
Adriaan van Os wroteL
Adriaan van Os wrote:
Peter Schorn wrote:
I am using the new gpc snapshot on OSX 10.4.10 (PPC) and compile the following program:
Did you patch the compiler with my diff for OS X or not ? Did you test on a powerpc or Intel Mac ? How was the compiler configured and built ?
I now see that you mentioned that it was powerpc. I can reproduce the bus error on i386-apple-darwin with -Os
[p17:~/gpc/testgpc/adriaan] adriaan% gpc -Os -g schorn1.pas [p17:~/gpc/testgpc/adriaan] adriaan% ./a.out access z before Bus error [p17:~/gpc/testgpc/adriaan] adriaan% gdb a.out GNU gdb 6.3.50-20050815 (Apple version gdb-573) (Fri Oct 20 15:50:43 GMT 2006) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-apple-darwin"...Reading symbols for shared libraries .. done
(gdb) run Starting program: /Users/adriaan/gnu/gpc/testgpc/adriaan/a.out Reading symbols for shared libraries . done access z before
Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00000000 D.919 (P={X = <invalid float value>, Y = <invalid float value>, V = {true, false}}) at schorn1.pas:16 16 if z then (gdb) bt full #0 D.919 (P={X = <invalid float value>, Y = <invalid float value>, V = {true, false}}) at schorn1.pas:16 P = { X = <invalid float value>, Y = <invalid float value>, V = {true, false} } #1 0x00001c43 in _p__M0_S0_Dcp () at schorn1.pas:21 Sp = { X = <invalid float value>, Y = <invalid float value>, V = {true, false} } #2 0x00001c8a in main (argc=-1073748152, argv=0x1b52, envp=0xbfffe7f4) at schorn1.pas:1 No locals.
I suppose this is a back-end bug, reproducible on other platforms.
I can not reproduce this on Amd64 Linux (tried verious option incuding -fPIC). I will try i386 Linux, but it looks that the program uses features that Apple decided to implement in its own way.
On linux i686, compiles & runs ok. output:
access z before z is true
gpc version:
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