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