------- Comment #3 from danglin at gcc dot gnu dot org  2008-11-08 17:28 -------
(gdb) r
Starting program: /test/gnu/gcc/objdir/gcc/testsuite/gcc/builtin-apply4.xg 
warning: Private mapping of shared library text was not specified
by the executable; setting a breakpoint in a shared library which
is not privately mapped will not work.  See the HP-UX 11i v3 chatr
manpage for methods to privately map shared library text.
warning: Loadable segment ".tbss" outside of ELF segments
warning: Loadable segment ".tbss" outside of ELF segments

Program received signal SIGSEGV, Segmentation fault.
bar (arg=<value optimized out>)
    at /test/gnu/gcc/gcc/gcc/testsuite/gcc.dg/builtin-apply4.c:20
20        __builtin_return (__builtin_apply ((void (*) ()) foo,
(gdb) p/x $pc
$1 = 0x4000000000002b2c
(gdb) disass 0x4000000000002b0c 0x4000000000002b3c
Dump of assembler code from 0x4000000000002b0c to 0x4000000000002b3c:
0x4000000000002b0c <bar+108>:   std r26,58(r3)
0x4000000000002b10 <bar+112>:   fstd fr4,60(r3)
0x4000000000002b14 <bar+116>:   b,l 0x4000000000002a68 <foo>,rp
0x4000000000002b18 <bar+120>:   std r0,10(r3)
0x4000000000002b1c <bar+124>:   ldd 10(r3),ret0
0x4000000000002b20 <bar+128>:   ldo 20(sp),sp
0x4000000000002b24 <bar+132>:   std r3,-8(sp)
0x4000000000002b28 <bar+136>:   copy r4,dp
0x4000000000002b2c <bar+140>:   ldd,mb -10(ret0),r31
0x4000000000002b30 <bar+144>:   std r31,-80(sp)
0x4000000000002b34 <bar+148>:   ldo -30(sp),ret1
0x4000000000002b38 <bar+152>:   ldd 8(ret0),ret0
End of assembler dump.

This is a wrong code bug.

Register r0 is always 0.  It is stored into the frame at 10(r3) in
the delay slot of the first call to foo.  The value is loaded
from 10(r3) into register ret0.  The segv is caused by the null
pointer used in the memory load at 0x4000000000002b2c. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37323

Reply via email to