summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr57287-2.c
blob: 1ddf76c646169fa913faa6708141fc08588b007e (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
28
29
30
31
32
33
34
35
/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */

#include <setjmp.h>

struct node
{
  struct node *next;
  char *name;
} *list;

struct node *list;
struct node *head (void);

jmp_buf *bar (void);

int baz (void)
{
  struct node *n;
  int varseen = 0;

  list = head ();
  for (n = list; n; n = n->next)
    {
      if (!varseen)
	varseen = 1;

      jmp_buf *buf = bar ();  /* { dg-bogus "may be used uninitialized" "" } */
      setjmp (*buf);
    }

  if (!varseen)
    return 0;
  return 1;
}