-fPIC bug on sparc
Brad Lucier
lucier@math.purdue.edu
Thu Sep 24 09:27:00 GMT 1998
I'm using (without any special configure options) the mainline
peano-36% gcc -v
Reading specs from /opt/egcs-mainline/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.92.11/specs
gcc version egcs-2.92.11 19980924 (gcc2 ss-980609 experimental)
with the extra patches from
CVSROOT: /egcs/carton/cvsfiles
Module name: egcs
Changes by: davem@egcs.cygnus.com 98/09/24 02:44:57
When the following routine
int ___isnan(double x)
{
unsigned long tmp = (*((unsigned long *) (&x) + (0)) ^ 0x7ff00000) & 0x7fffffff;
return (tmp < 0x100000) && ((tmp | *((unsigned long *) (&x) + (1))) != 0);
}
is compiled with
gcc -fPIC -O2 -S setupE.c
the assembly code is:
___isnan:
!#PROLOGUE# 0
add %sp, -120, %sp
ld [%sp+96], %g3 <= loads first word from stack before storing!!
sethi %hi(2146435072), %g2
xor %g3, %g2, %g3
sethi %hi(-2147483648), %o2
sethi %hi(1047552), %g2
andn %g3, %o2, %g3
or %g2, 1023, %g2
std %o0, [%sp+96] <= stores double arg in %o0-%o1 on stack
cmp %g3, %g2
bgu .LL330
mov 0, %o0
ld [%sp+100], %g2 <= loads second word from stack
or %g3, %g2, %g2
subcc %g0, %g2, %g0
addx %g0, 0, %o0
.LL330:
retl
sub %sp, -120, %sp
.LLfe30:
.size ___isnan,.LLfe30-___isnan
So this routine returns a random value, depending on what's on the stack
when it's called.
There is no problem with -fPIC -O1
Brad Lucier lucier@math.purdue.edu
More information about the Gcc-bugs
mailing list