Structure alignment under AIX 4.3.1

Jacques_Goussard@cimmetry.com Jacques_Goussard@cimmetry.com
Mon May 17 13:15:00 GMT 1999


Hi
Found that various structure declaration that are equivalent on other
platforms than AIX4.3.1 (tested Solaris and HPUX) could be not equivalent under
AIX.
Could this alignment pb be a bug :
gcc -v : gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
uname -a : AIX neptune 3 4 004558184C00

TEST : compiled with no specific options

#include <stdio.h>
#include <stdlib.h>

typedef struct _D3d {
     double x,y,z;
} D3d;
typedef struct _D3d_tab{
     double x[3];
} D3d_tab;
typedef struct _L1D3_tab {
     long int l;
     double d[3];
} L1D3_tab;
typedef struct _L1D3_struc1{
     long int l;
     D3d d;
} L1D3_struc1;
typedef struct _L1D3_struc2{
     long int l;
     D3d_tab d;
} L1D3_struc2;

 int main()
{
     printf("%i\n",sizeof(L1D3_tab));
     printf("%i\n",sizeof(L1D3_struc1));
     printf("%i\n",sizeof(L1D3_struc2));

     return 0;
}
produces
28
32
28
as output ?
Could it be 4-bytes aligned in first struct, 8-bytes in second and again 4 in
third ???

     Jacques-Olivier Goussard




More information about the Gcc-bugs mailing list