[Bug middle-end/24462] [4.1/4.2 Regression] packed-aligned structures are laid out differently

jakub at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Dec 29 12:32:00 GMT 2005



------- Comment #8 from jakub at gcc dot gnu dot org  2005-12-29 12:32 -------
Is this still a problem?
I certainly can't reproduce this on sparc*-linux:
struct B1_m_outer_p_inner {
  char c;
  double d;
} __attribute__ ((aligned)) __attribute__ ((packed)) s;
extern void abort (void);
int main ()
{
  char *p, *q;
  if (sizeof (struct B1_m_outer_p_inner) != 16 || __alignof__ (struct
B1_m_outer_p_inner) != 8
      || sizeof (s) != 16 || __alignof__ (s) != 8
      || __alignof__ (s.c) != 1
      || __alignof__ (s.d) != 1)
    abort ();
  p = &s.c;
  q = (char *) &s.d;
  if (q - p != 1)
    abort ();
  return 0;
}

succeeds with both GCC 3.4.x and current trunk.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


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



More information about the Gcc-bugs mailing list