This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/53219] inline function erroneously clobbers %i0 register on 64 bit sparc compile of perls regcomp.c
- From: "martin at netbsd dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 06 May 2012 10:59:19 +0000
- Subject: [Bug target/53219] inline function erroneously clobbers %i0 register on 64 bit sparc compile of perls regcomp.c
- Auto-submitted: auto-generated
- References: <bug-53219-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53219
--- Comment #7 from Martin Husemann <martin at netbsd dot org> 2012-05-06 10:59:19 UTC ---
Created attachment 27324
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27324
gcc -S output for the miscompiled function
The original report showed the disassembler output from gdb; here is the
original compiler output (stripped to the function in question, I can provide
the full output if needed).
The crash happens in the section starting at line 521:
.LLBB1732:
.loc 1 4563 0
ldx [%i0+624], %g1
add %fp, 1695, %o0
mov 0, %o1
call __sigsetjmp14, 0
stx %g1, [%fp+1687]
.LLVL2000:
add %fp, 1687, %g1
st %o0, [%fp+1815]
.LLBE1732:
.loc 1 4567 0
andcc %o0, 0xff, %o1
.LLBB1733:
.loc 1 4563 0
stx %g1, [%i0+624]
on return from the sigsetjmp %i0 is zero and we crash in the last line cited
above.
I think the register %i0 is left as zero after (post first call to sigsetjmp)
when going throught he code starting at line 77:
.LLVL1968:
.LL2453:
.LLBB1694:
.LLBB1695:
.loc 3 77 0
ldx [%fp+2191], %i0
.LLVL1969:
.LL2734:
and %i0, 224, %g1
srl %g1, 5, %g1
.LLVL1970:
.LLBE1695:
.LLBE1694:
.loc 1 4617 0
cmp %g1, 1
This register value later gets saved to the on-stack copy of the register
window, from where it is restored on siglongjmp.