This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/11446] New: Incompatibilty with alignment of structures between 3.3 and 3.4 CVS


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Incompatibilty with alignment of structures between 3.3
                    and 3.4 CVS
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aj at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-linux-gnu
  GCC host triplet: i686-linux-gnu
GCC target triplet: i686-linux-gnu

On i686-linux-gnu the struct-align-1
testcase fails if I mix objects from GCC 3.3 and GCC 3.4 using current
CVS versions, the testsuite reports:

FAIL: gcc.dg/compat/struct-align-1 c_compat_x_tst.o-c_compat_y_alt.o execute 
FAIL: gcc.dg/compat/struct-align-1 c_compat_x_alt.o-c_compat_y_tst.o execute 

Here's an example compile session:

$ /opt/gcc/3.3-devel/bin/gcc -c -DDBG struct-align-1_x.c
$ /opt/gcc/3.4-devel/bin/gcc -c -DDBG struct-align-1_y.c
$ /opt/gcc/3.4-devel/bin/gcc -c -DDBG struct-align-1_main.c 
$ /opt/gcc/3.4-devel/bin/gcc -DDBG *.o -o struct-align-1
$ ./struct-align-1 
original
  global variable.......
  global array.......
  argument.......
  function result.......
packed attribute for all
  global variable.......
  global array.......
  argument.......
  function result.......
packed attribute for inner
  global variable.......
  global array.......
  argument.......
  function result.......
packed attribute for outer
  global variable.......
  global array.......
  argument.......
  function result.......
maximum useful struct alignment for all
  global variable.......
  global array.......
  argument.......
  function result.......
maximum alignment for outer, packed inner
  global variable.......
  global array.......
  argument.......
  function result.......
maximum alignment for inner, packed outer
  global variable...F.FF
  global array..FFFFF
  argument...F.FF
  function result...F.FF
failed
Aborted
gromit:~/tmp/align-1:[134]$ 

The structure that fails is:

#define DESC_m_inner_p_outer "maximum alignment for inner, packed outer"
struct B1_m_inner_p_outer {
  char c;
  double d;
} __attribute__ ((aligned)) __attribute__ ((packed));

A diff between struct_align-1_x.s between GCC 3.3 and 3.4 shows:
 .globl b2_a_max
-       .align 32
+       .align 16
...
 .globl b2_m_inner_p_outer
+       .align 16
        .type   b2_m_inner_p_outer, @object
-       .size   b2_m_inner_p_outer, 17
+       .size   b2_m_inner_p_outer, 32
...
 .globl ab2_m_inner_p_outer
-       .align 32
+       .align 16
        .type   ab2_m_inner_p_outer, @object
-       .size   ab2_m_inner_p_outer, 34
+       .size   ab2_m_inner_p_outer, 64

So, we have different alignment and therefore sizes. :-(


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]