Maybe there are two bugs here.

#include <stdio.h>

typedef int ix __attribute__ ((__aligned__ (16)));
typedef volatile int vx __attribute__ ((__aligned__ (16)));

ix ix1 = __alignof__ (ix);
ix ix2 = __alignof__ (ix1);
vx vx1 = __alignof__ (vx);
vx vx2 = __alignof__ (vx1);

int main(void)
{
  printf ("ix1: %d, ix2: %d, vx1: %d, vx2: %d\n",
          ix1, ix2, vx1, vx2);
  return ix1 == ix2 && ix1 == vx1 && ix1 == vx2 ? 0 : 1;
}

For i686-pc-linux-gnu, observe 16, 16, 4, 4 for the above program.  That's by
itself surprising: the "volatile" specifier seems to nullify the attribute
specifier.

For crisv32-axis-linux-gnu it's even worse: it's 16, 16, 1, 4 at -O0, but 16,
16, 4, 4 at -O2.  Bother.


-- 
           Summary: volatile data types ignore __attribute__ ((__aligned
                    ...))
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hp at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: crisv32-axis-linux-gnu, i686-pc-linux-gnu


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

Reply via email to