1 /* PR c/53037. */ 2 /* { dg-do compile } */ 3 /* { dg-options "-O0 -Wpacked-not-aligned" } */ 4 /* { dg-skip-if "" { avr-*-* } } */ 5 6 struct __attribute__ ((aligned (8))) S8 { char a[8]; }; 7 struct __attribute__ ((packed)) S1 { 8 struct S8 s8; 9 }; /* { dg-warning "alignment 1 of 'struct S1' is less than 8" } */ 10 11 struct __attribute__ ((packed, aligned (8))) S2 { 12 struct S8 s8; 13 }; 14 15 struct __attribute__ ((packed, aligned (8))) S3 { 16 int i1; 17 struct S8 s8; /* { dg-warning "'s8' offset 4 in 'struct S3' isn't aligned to 8" } */ 18 }; 19 20 struct __attribute__ ((packed, aligned (8))) S4 { 21 int i1; 22 int i2; 23 struct S8 s8; 24 }; 25 26 struct __attribute__ ((packed)) S5 { 27 long long ll; 28 }; 29 30 union __attribute__ ((packed)) U1 { 31 int i1; 32 struct S8 s8; 33 }; /* { dg-warning "alignment 1 of 'union U1' is less than 8" } */ 34 35 union __attribute__ ((packed, aligned (8))) U2 { 36 int i1; 37 struct S8 s8; 38 }; 39