The following problem was seen in a testcase under discussion in PR 30634: # cat yy.c #include <stdio.h> double f(void) { long long t = 0x000fffffffffffff; double t1; __builtin_memcpy(&t1, &t, sizeof(long long)); return t1; } int main() { union { long long ll; double d; } u;
u.d = f (); printf ("ll = 0x%llx\n", u.ll); return 0; } # ../../xgcc -B../../ -O2 -o yy yy.c # ./yy ll = 0xffffffff000fffff # ../../xgcc -B../../ -O0 -o yy yy.c # ./yy ll = 0xfffffffffffff # ../../xgcc -B../../ -v Reading specs from ../../specs Target: hppa64-hp-hpux11.00 Configured with: ../gcc/configure --with-gnu-as --with-as=/opt/gnu64/bin/as --with-ld=/usr/ccs/bin/ld --enable-shared --with-local-prefix=/opt/gnu64 --prefix=/opt/gnu64/gcc/gcc-4.2.0 --host=hppa64-hp-hpux11.00 --disable-nls --with-gmp=/opt/gnu64/gcc/gcc-4.2.0 Thread model: posix gcc version 4.2.0 20070123 (prerelease) The constant 0x000fffffffffffff appears in the assembler output as a pair of 32-bit .word values. The values are reversed when the testcase is compiled at -O2. This doesn't appear to be a target issue since the target only defines directives for the output of constants. -- Summary: Incorrect constant generation for long long Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: danglin at gcc dot gnu dot org GCC build triplet: hppa64-hp-hpux11.00 GCC host triplet: hppa64-hp-hpux11.00 GCC target triplet: hppa64-hp-hpux11.00 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30704