http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60528
Bug ID: 60528
Summary: MIPS GCC puts out complex constant incorrectly when in
big-endian mode
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: sje at gcc dot gnu.org
CC: rsandifo at gcc dot gnu.org
Target: mips-*-*
The included test program prints out:
x = 0.634964 1.298458
x = inf inf
on MIPS instead of:
x = 0.634964 1.298458
x = 0.182506 1.163916
To reproduce the problem you need to compile the program with no optimization
(-O0) and in big-endian mode. Little endian mode seems fine. When I compare
the assembly language output to an earlier 4.8.1 GCC, the latest GCC output
contains the following code to store the complex constant passed in to csinh:
$LC0:
.word 1071927711
.word 3624173458
.word 1073006203
.word 1962331215
Earlier GCC compilers that worked contained:
$LC0:
.word 1071927711
.word -670793838
.word 1073006203
.word 1962331215
Test case:
#include <stdio.h>
#include <complex.h>
#include <math.h>
int main()
{
double complex x;
x = 0.63496391478473613 + 1.2984575814159773I;
printf("x = %f %f\n", creal(x), cimag(x));
x = csinh(x);
printf("x = %f %f\n", creal(x), cimag(x));
return 0;
}