This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Segmentation fault with -fPIC -O1 on egcs-19990412
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: Re: Segmentation fault with -fPIC -O1 on egcs-19990412
- From: Brad Lucier <lucier at math dot purdue dot edu>
- Date: Fri, 16 Apr 1999 09:17:45 -0500 (EST)
- Cc: lucier at math dot purdue dot edu
OK, I did a bit more work on isolating the problem in
http://egcs.cygnus.com/ml/egcs-bugs/1999-04/msg00428.html
The assembly output for the current snapshot compiling this
code with -O1 -fPIC is at the end of this message.
I compiled it with egcs-1.1.2 with the same options and compared
the assembly code. After some editing, the significant differences
seemed to be:
***************
*** 49,75 **** ;;; egcs-1.1.2
add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
std %i0, [%fp-24]
ldd [%fp-24], %f2
! sethi %hi(.LLC1), %o0
! or %o0, %lo(.LLC1), %o0
! ld [%l7+%o0], %o0
! ldd [%o0], %f4
! fmuld %f2, %f4, %f4
! std %f4, [%fp-16]
ldd [%fp-16], %o0
call test, 0
add %fp, -24, %o2
ldd [%fp-24], %f2
! sethi %hi(.LLC1), %o3
! or %o3, %lo(.LLC1), %o3
! ld [%l7+%o3], %o3
! ldd [%o3], %f4
! fmuld %f2, %f4, %f4
! std %f4, [%fp-16]
ldd [%fp-16], %o0
call test, 0
add %fp, -24, %o2
! ret
! restore
.LLfe2:
.size call_test,.LLfe2-call_test
.section ".rodata"
--- 49,71 ---- ;;; egcs-19990412
add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
std %i0, [%fp-24]
ldd [%fp-24], %f2
! sethi %hi(.LLC1), %o2
! ldd [%o2+%lo(.LLC1)], %f4
! fmuld %f2, %f4, %f2
! std %f2, [%fp-16]
ldd [%fp-16], %o0
call test, 0
add %fp, -24, %o2
ldd [%fp-24], %f2
! sethi %hi(.LLC1), %o2
! ldd [%o2+%lo(.LLC1)], %f4
! fmuld %f2, %f4, %f2
! std %f2, [%fp-16]
ldd [%fp-16], %o0
call test, 0
add %fp, -24, %o2
! return %i7+8
! nop
.LLfe2:
.size call_test,.LLfe2-call_test
.section ".rodata"
in the first set of differences.
Hope this helps track down the problem.
Brad Lucier lucier@math.purdue.edu
Assembler output:
.file "test-egcs.c"
gcc2_compiled.:
.section ".rodata"
.align 8
.LLC0:
.asciz "%f %f\n"
.section ".text"
.align 32
.LLGETPC0:
retl
add %o7,%l7,%l7
.align 32
.global test
.type test,#function
.proc 020
test:
!#PROLOGUE# 0
save %sp, -112, %sp
sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
call .LLGETPC0
add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
sethi %hi(.LLC0), %o0
or %o0, %lo(.LLC0), %o0
ld [%l7+%o0], %o0
mov %i0, %o1
mov %i1, %o2
ld [%i2], %o3
call printf, 0
ld [%i2+4], %o4
return %i7+8
nop
.LLfe1:
.size test,.LLfe1-test
.section ".rodata"
.align 8
.LLC1:
.uaword 0x3fe00000 ! ~5.00000000000000000000e-1
.uaword 0x0
.section ".text"
.align 32
.global call_test
.type call_test,#function
.proc 020
call_test:
!#PROLOGUE# 0
save %sp, -120, %sp
sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
call .LLGETPC0
add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
std %i0, [%fp-24]
ldd [%fp-24], %f2
sethi %hi(.LLC1), %o2
ldd [%o2+%lo(.LLC1)], %f4
fmuld %f2, %f4, %f2
std %f2, [%fp-16]
ldd [%fp-16], %o0
call test, 0
add %fp, -24, %o2
ldd [%fp-24], %f2
sethi %hi(.LLC1), %o2
ldd [%o2+%lo(.LLC1)], %f4
fmuld %f2, %f4, %f2
std %f2, [%fp-16]
ldd [%fp-16], %o0
call test, 0
add %fp, -24, %o2
return %i7+8
nop
.LLfe2:
.size call_test,.LLfe2-call_test
.section ".rodata"
.align 8
.LLC2:
.uaword 0x3ff00000 ! ~1.00000000000000000000e0
.uaword 0x0
.section ".text"
.align 32
.global main
.type main,#function
.proc 04
main:
!#PROLOGUE# 0
save %sp, -112, %sp
sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
call .LLGETPC0
add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
sethi %hi(.LLC2), %o0
or %o0, %lo(.LLC2), %o0
ld [%l7+%o0], %o0
call call_test, 0
ldd [%o0], %o0
return %i7+8
mov 0, %o0
.LLfe3:
.size main,.LLfe3-main
.ident "GCC: (GNU) egcs-2.93.18 19990412 (gcc2 ss-980929 experimental)"