(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr53037-1.c
       1  /* PR c/53037.  */
       2  /* { dg-do compile } */
       3  /* { dg-options "-O0" } */
       4  /* { dg-require-effective-target int32 } */
       5  
       6  typedef unsigned long long __u64
       7    __attribute__((aligned(4),warn_if_not_aligned(8)));
       8  
       9  struct foo1
      10  {
      11    int i1;
      12    int i2;
      13    int i3;
      14    __u64 x; /* { dg-warning "'x' offset 12 in 'struct foo1' isn't aligned to 8" } */
      15  }; /* { dg-warning "alignment 4 of 'struct foo1' is less than 8" } */
      16  
      17  struct foo2
      18  {
      19    int i1;
      20    int i2;
      21    int i3;
      22    __u64 x; /* { dg-warning "'x' offset 12 in 'struct foo2' isn't aligned to 8" } */
      23  } __attribute__((aligned(8)));
      24  
      25  struct foo3
      26  {
      27    int i1;
      28    int i3;
      29    __u64 x;
      30  }; /* { dg-warning "alignment 4 of 'struct foo3' is less than 8" } */
      31  
      32  struct foo4
      33  {
      34    int i1;
      35    int i2;
      36    __u64 x;
      37  } __attribute__((aligned(8)));
      38  
      39  struct foo5
      40  {
      41    int i1;
      42    int x __attribute__((warn_if_not_aligned(16))); /* { dg-warning "'x' offset 4 in 'struct foo5' isn't aligned to 16" } */
      43  }; /* { dg-warning {alignment [0-9]+ of 'struct foo5' is less than 16} } */
      44  
      45  struct foo6
      46  {
      47    int i1;
      48    int x __attribute__((warn_if_not_aligned(16))); /* { dg-warning "'x' offset 4 in 'struct foo6' isn't aligned to 16" } */
      49  } __attribute__((aligned(16)));
      50  
      51  struct foo7
      52  {
      53    int i1;
      54    int i2;
      55    int i3;
      56    int i4;
      57    int x __attribute__((warn_if_not_aligned(16)));
      58  } __attribute__((aligned(16)));
      59  
      60  union bar1
      61  {
      62    int i1;
      63    __u64 x;
      64  }; /* { dg-warning "alignment 4 of 'union bar1' is less than 8" } */
      65  
      66  union bar2
      67  {
      68    int i1;
      69    __u64 x;
      70  } __attribute__((aligned(8)));
      71  
      72  union bar3
      73  {
      74    int i1;
      75    int x __attribute__((warn_if_not_aligned(16))); 
      76  }; /* { dg-warning {alignment [0-9]+ of 'union bar3' is less than 16} } */
      77  
      78  union bar4
      79  {
      80    int i1;
      81    int x __attribute__((warn_if_not_aligned(16)));
      82  } __attribute__((aligned(16)));