(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr51628-34.c
       1  /* PR c/51628.  */
       2  /* { dg-do compile } */
       3  /* { dg-options "-O -Wno-incompatible-pointer-types" } */
       4  
       5  struct __attribute__((packed)) S { char p; int a, b, c; };
       6  
       7  short *
       8  baz (int x, struct S *p)
       9  {
      10    return (x
      11  	  ? &p->a 
      12  /* { dg-warning "may result in an unaligned pointer value" "" { target { ! default_packed } } .-1 } */
      13  	  : &p->b);
      14  /* { dg-warning "may result in an unaligned pointer value" "" { target { ! default_packed } } .-1 } */
      15  }
      16  
      17  short *
      18  qux (int x, struct S *p)
      19  {
      20    return (short *) (x
      21  		    ?  &p->a
      22  /* { dg-warning "may result in an unaligned pointer value" "" { target { ! default_packed } } .-1 } */
      23  		    : &p->b);
      24  /* { dg-warning "may result in an unaligned pointer value" "" { target { ! default_packed } } .-1 } */
      25  }