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

Bug#186937: [hppa, PR target/10271] Floating point args don't get reloaded across function calls at -O2



Package: gcc-3.2
Severity: important

[Debian note: this may be related to #185184 and #105816]

When compiling the bug.c code below with -O2, the floating point 
argument to the fprintf does not get reloaded for the second fprintf() 
call, so the second call prints junk. At -O1 the arguments (r23/r24) 
are properly reloaded.
 
Compile with gcc -O2 -o bug bug.c -lm
$ ./bug
nan
1.422968e-309

With -O1
$ ./bug
nan
nan

------8< bug.c 8<--------
#include <stdio.h>
#include <math.h>

void doprint(double dval)
{
        fprintf(stdout, "%e\n", dval);
        fprintf(stdout, "%e\n", dval);
}

int main(int argc, char **argv)
{
        doprint(log(-8)); /* nan */
        return 0;
} 




Reply to: