[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: gcc-3.2: miscompilation on powerpc with -O2 or higher

Greetings!  Just a followup note to say that I've reconfirmed this
problem, and have a gdb trace.  All is well with 2.95 -O6
-fomit-frame-pointer, but the following happens with gcc-3.2 with -O2
or greater: (For the time being, GCL lowers its gcc optimization to -O
when using powerpc and >=gcc-3.2. )

camm@voltaire:~/gcl1/unixport$ gcc-3.2 -v
gcc-3.2 -v
Reading specs from /usr/lib/gcc-lib/powerpc-linux/3.2.3/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc powerpc-linux
Thread model: posix
gcc version 3.2.3 20030210 (Debian prerelease)

cpp -I../h new_init.c |grep -5 MACROEXP

{ extern object sLfuncall ; sLfuncall = (1 == 1 ? make_ordinary("FUNCALL") : 1 == 0 ? make_si_ordinary("FUNCALL"): 1 == 2 ? make_keyword("FUNCALL"): (error("Bad pack variable in DEF_ORDINARY\n"),(object)0));}
{ extern object sLAmacroexpand_hookA; sLAmacroexpand_hookA = (1 == 1 ? make_special("*MACROEXPAND-HOOK*",sLfuncall) : (1 == 0 ? make_si_special("*MACROEXPAND-HOOK*",sLfuncall): (error("Bad pack variable in DEFVAR\n"),(object)0)));}

gdb raw_gcl
gdb raw_gcl
GNU gdb 5.3-debian
Copyright 2002 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 "powerpc-linux"...
(gdb) r ./ <foo
r ./ <foo
Starting program: /home/camm/gcl1/unixport/raw_gcl ./ <foo
GCL (GNU Common Lisp)  April 1994  32768 pages
Building symbol table for /home/camm/gcl1/unixport/raw_gcl ..
loading ./../lsp/export.lsp
Initializing defmacro.o
Initializing evalmacros.o
Initializing top.o
Initializing module.o
loading ./../lsp/autoload.lsp

Program received signal SIGSEGV, Segmentation fault.
IapplyVector (fun=0x0, nargs=3, base=0x10264998) at nfunlink.c:197
197	  switch(type_of(fun)) {
(gdb) b make_special
b make_special
Breakpoint 1 at 0x1002d1f4: file symbol.d, line 112.
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: /home/camm/gcl1/unixport/raw_gcl ./ <foo
GCL (GNU Common Lisp)  April 1994  32768 pages

Breakpoint 1, make_special (s=0x10249edc "*MACROEXPAND-HOOK*", v=0x0)
    at symbol.d:112
112		x = make_ordinary(s);
(gdb) bt
#0  make_special (s=0x10249edc "*MACROEXPAND-HOOK*", v=0x0) at symbol.d:112
#1  0x10006f0c in NewInit () at new_init.c:128
#2  0x100032e8 in initlisp () at main.c:464
#3  0x10002d04 in main (argc=270925824, argv=0x10260000, envp=0x10300000)
    at main.c:330
#4  0x0fd08e04 in __libc_start_main () from /lib/libc.so.6
(gdb) p &make_special
p &make_special
$4 = (object (*)(char *, object)) 0x1002d1e0 <make_special>
(gdb) frame 0
frame 0
#0  make_special (s=0x10249edc "*MACROEXPAND-HOOK*", v=0x0) at symbol.d:112
112		x = make_ordinary(s);
(gdb) p &v
p &v
Address requested for identifier "v" which is in register $r29
(gdb) frame 1
frame 1
#1  0x10006f0c in NewInit () at new_init.c:128
128	DEFVAR("*MACROEXPAND-HOOK*",sLAmacroexpand_hookA,LISP,sLfuncall,"")
(gdb) p sLfuncall
p sLfuncall
$5 = 0x10318288
(gdb) p &sLfuncall
p &sLfuncall
$6 = (object *) 0x10262c10
(gdb) i reg
i reg
r0             0x10006f0c	268463884
r1             0x7ffffc50	2147482704
r2             0x0	0
r3             0x10249edc	270835420
r4             0x0	0
r5             0x0	0
r6             0x10249ed4	270835412
r7             0x262f6cd5	640642261
r8             0x1	1
r9             0x10260000	270925824
r10            0x7	7
r11            0x7	7
r12            0x80808080	-2139062144
r13            0x1026a680	270968448
r14            0x0	0
r15            0x0	0
r16            0x0	0
r17            0x0	0
r18            0x0	0
r19            0x0	0
r20            0x10260000	270925824
r21            0xa	10
r22            0x10300000	271581184
r23            0x10260000	270925824
r24            0x10010000	268500992
r25            0x7fffffff	2147483647
r26            0x10290000	271122432
r27            0x10300000	271581184
r28            0x10260000	270925824
r29            0x10300000	271581184
r30            0x10260000	270925824
r31            0x10300000	271581184
pc             0x1002d1f4	268620276
ps             0x2d032	184370
cr             0x48000822	1207961634
lr             0x10006f0c	268463884
ctr            0x1000babc	268483260
xer            0x20000000	536870912
fpscr          0x82024000	-2113781760
vscr           0x0	0
vrsave         0x0	0
(gdb) disassemble


0x10006edc <NewInit+2616>:	bl	0x10087e5c <LISP_makefun>
0x10006ee0 <NewInit+2620>:	lis	r3,4133
0x10006ee4 <NewInit+2624>:	addi	r3,r3,-24876
0x10006ee8 <NewInit+2628>:	crclr	4*cr1+eq
0x10006eec <NewInit+2632>:	bl	0x1002d0c8 <make_ordinary>
0x10006ef0 <NewInit+2636>:	lis	r9,4134
0x10006ef4 <NewInit+2640>:	mr	r0,r3
0x10006ef8 <NewInit+2644>:	lwz	r4,11280(r9)
0x10006efc <NewInit+2648>:	lis	r3,4133
0x10006f00 <NewInit+2652>:	stw	r0,11280(r9)
0x10006f04 <NewInit+2656>:	addi	r3,r3,-24868
0x10006f08 <NewInit+2660>:	bl	0x1002d1e0 <make_special>
---Type <return> to continue, or q <return> to quit---
0x10006f0c <NewInit+2664>:	lis	r9,4134
0x10006f10 <NewInit+2668>:	stw	r3,10576(r9)
0x10006f14 <NewInit+2672>:	lis	r3,4133
0x10006f18 <NewInit+2676>:	addi	r3,r3,-24848
0x10006f1c <NewInit+2680>:	crclr	4*cr1+eq
0x10006f20 <NewInit+2684>:	bl	0x1002d258 <make_si_ordinary>
0x10006f24 <NewInit+2688>:	lis	r9,4134
0x10006f28 <NewInit+2692>:	mr	r0,r3
0x10006f2c <NewInit+2696>:	addi	r4,r29,-5488
0x10006f30 <NewInit+2700>:	lis	r3,4133
0x10006f34 <NewInit+2704>:	stw	r0,10348(r9)
0x10006f38 <NewInit+2708>:	addi	r3,r3,-24836


Take care,

Camm Maguire			     			camm@enhanced.com
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah

Reply to: