1 /* PR c/89061 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wjump-misses-init" } */
4
5 struct S { int s; };
6
7 int
8 foo (int x)
9 {
10 struct S s = { 0 };
11 if ((s.s = x) == 0)
12 goto cleanup; /* { dg-bogus "jump skips variable initialization" } */
13 s = (struct S) { .s = 42 };
14 cleanup:
15 return s.s;
16 }
17
18 int
19 bar (int x)
20 {
21 struct S *s = &(struct S) { 0 };
22 if ((s->s = x) == 0)
23 goto cleanup; /* { dg-bogus "jump skips variable initialization" } */
24 s = &(struct S) { .s = 42 };
25 cleanup:
26 return s->s;
27 }