(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pack-test-3.c
       1  /* { dg-do compile } */
       2  
       3  /* Copyright (C) 2003 Free Software Foundation, Inc.
       4     Contributed by Nathan Sidwell 15 Jul 2003 <nathan@codesourcery.com> */
       5  
       6  /* you should not be able to pack a typedef to a struct, only the
       7     underlying struct can be packed.  */
       8  
       9  /* ok */
      10  struct u1
      11  {
      12    char field1;
      13    short field2;
      14    int field3;
      15  };
      16  
      17  /* ok */
      18  typedef struct p1 {
      19     char  field1;
      20     short field2;
      21     int field3;
      22  } __attribute__ ((packed)) p1_t1;
      23  
      24  /* ok */
      25  typedef struct __attribute__ ((packed)) p2 {
      26     char  field1;
      27     short field2;
      28     int field3;
      29  } p2_t1;
      30  
      31  int ary1[sizeof (struct p1) == sizeof (p1_t1) ? 1 : -1];
      32  int ary2[sizeof (struct p2) == sizeof (p2_t1) ? 1 : -1];
      33  int ary3[sizeof (struct p1) == sizeof (struct p2) ? 1 : -1];
      34  
      35  /* not ok */
      36  typedef struct u1 __attribute__ ((packed)) u1_t1; /* { dg-warning "attribute ignored" }*/
      37  typedef struct u1 u1_t2 __attribute__ ((packed)); /* { dg-warning "attribute ignored" }*/
      38  
      39  typedef struct p3 {
      40     char  field1;
      41     short field2;
      42     int field3;
      43  } p3_t1 __attribute__ ((packed)); /* { dg-warning "attribute ignored" }*/
      44