blob: 6b5d913401ef786a5eee9f182f339f8bbc259f56 [file] [log] [blame]
/* 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;
}