Wattributes-10.c: Add -fno-common option on hppa*-*-hpux*.
[official-gcc.git] / gcc / testsuite / c-c++-common / pr51628-6.c
blob52aa07a4cf3f64160c13518a2035a092f44b095a
1 /* PR c/51628. */
2 /* { dg-do compile } */
3 /* { dg-options "-O" } */
5 struct pair_t
7 char x;
8 int i;
9 } __attribute__((packed, aligned (4)));
11 extern struct pair_t p;
12 extern int *x;
13 extern void bar (int *);
15 int *addr = &p.i;
16 /* { dg-warning "may result in an unaligned pointer value" "" { target *-*-* } .-1 } */
18 int *
19 foo (void)
21 struct pair_t arr[2] = { { 1, 10 }, { 2, 20 } };
22 int *p0, *p1;
23 p0 = &arr[0].i;
24 /* { dg-warning "may result in an unaligned pointer value" "" { target *-*-* } .-1 } */
25 bar (p0);
26 p1 = &arr[1].i;
27 /* { dg-warning "may result in an unaligned pointer value" "" { target *-*-* } .-1 } */
28 bar (p1);
29 bar (&p.i);
30 /* { dg-warning "may result in an unaligned pointer value" "" { target *-*-* } .-1 } */
31 x = &p.i;
32 /* { dg-warning "may result in an unaligned pointer value" "" { target *-*-* } .-1 } */
33 return &p.i;
34 /* { dg-warning "may result in an unaligned pointer value" "" { target *-*-* } .-1 } */