Given the declaration: typedef volatile double D __attribute__((aligned(16)));
gcc and g++ give different alignments (and thus differing offsets and sizes)
for structures that contain D.  Removal of the volatile qualifier changes the
alignment behavior.

$ g++ -m32 vs.c && ./a.out
$ gcc -m32 -Dvolatile= vs.c && ./a.out
$ gcc -m32 vs.c && ./a.out
a.out: vs.c:8: main: Assertion `__alignof__(S) == 8' failed.
Aborted

$ gcc -v 2>&1 | tail -1
gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu4)


-- 
           Summary: gcc does not honor alignment specification, gives
                    different alignment than g++
           Product: gcc
           Version: 4.2.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jepler at unpythonic dot net
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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

Reply via email to