aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/uninit-pr61677.c
blob: a982fae31a47279429bb5438ce2f6ef60ee25e84 (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
/* PR tree-optimization/61677 - False positive with -Wmaybe-uninitialized
   { dg-do compile }
   { dg-options "-O2 -Wall" } */

void *xmalloc (void);

struct menu { struct menu *parent; };

struct jump_key { int offset; };

void f (struct menu *menu)
{
  int i;
  struct menu *submenu[8], *location;
  struct jump_key *jump;
  location = menu;
  for (i = 0; menu && i < 8; menu = menu->parent)
    submenu[i++] = menu;
  if (location)
    jump = xmalloc ();
  while (--i >= 0) {
    menu = submenu[i];
    if (location)
      jump->offset = 42;
  }
}