[Bug c/28196] New: miscompiled initialization of a constant pointer reference with offset (ppc64 target)

2006-06-28 Thread inbox at b-q-c dot com
The following code is miscompiled when using -m64 (=ppc64) target:

const static double a = 1.0;
const static double *b = (double*)&a - 1;

&b[1] should be &a, but it's not - there is an additional offset of 0x1


-- 
   Summary: miscompiled initialization of a constant pointer
reference with offset (ppc64 target)
   Product: gcc
   Version: 4.0.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: inbox at b-q-c dot com
 GCC build triplet: powerpc-apple-darwin8.6
  GCC host triplet: powerpc-apple-darwin8.6
GCC target triplet: powerpc-apple-darwin8.6 (ppc64)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28196



[Bug c/28196] miscompiled initialization of a constant pointer reference with offset (ppc64 target)

2006-06-28 Thread inbox at b-q-c dot com


--- Comment #1 from inbox at b-q-c dot com  2006-06-28 20:44 ---
Created an attachment (id=11774)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11774&action=view)
test case - returns 0 on success or 1 when miscompiled

gcc -m64 -o gcc64bug gcc64bug.c

Inspection of the a and b will show:
a = 1fe8
b = 11fe0


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28196



[Bug c/28196] miscompiled initialization of a constant pointer reference with offset (ppc64 target)

2006-06-28 Thread inbox at b-q-c dot com


--- Comment #2 from inbox at b-q-c dot com  2006-06-28 20:47 ---
The original description should state that there is an additional offset of
0x1 (it said 0x1 instead).
Also this bug is reproducible with earlier version of gcc such as 4.0.1 as
supplied by Apple.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28196



[Bug c/28196] miscompiled initialization of a constant pointer reference with offset (ppc64 target)

2006-06-28 Thread inbox at b-q-c dot com


--- Comment #3 from inbox at b-q-c dot com  2006-06-28 20:50 ---
Created an attachment (id=11775)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11775&action=view)
output of gcc -v


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28196