System.
Fedora 11 - Linux 2.6.30.8-64.fc11.x86_64 #1 SMP
gcc-4.4.1, Release: 2.fc11 (Fedora's package)


Problem in short.
definitions:
  typedef uint64_t obj[1];
obj x0, x1, X[2];
then the following code doesn't work:
  X[0][0] = x0[0];
  X[1][0] = x1[0];
while this works:
  *X[0] = *x0;
  *X[1] = *x1;
(As far as I know these are equivalent).
Problem only with -O3 and 64-bit code.
Works perfectly at least with gcc34, -O2 and/or 32-bit code.


Detailed information.

The program gcc-bug.c compiled as
  gcc -Wall -O3 -o gcc-bug gcc-bug.c
produce the following (wrong) output:
(1) x0 = 12345
(1) x1 = 67890
(2) x0 = 12345
(2) x1 = 4195296
instead of the correct one:
(1) x0 = 12345
(1) x1 = 67890
(2) x0 = 12345
(2) x1 = 67890

In attachment gcc-bug.c and gcc-bug.i, generated with -v -save-temps.


-- 
           Summary: Optimization error on vectors of uint64_t
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: emanuele dot cesena at gmail dot com


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

Reply via email to