aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/uninit-pred-10.c
blob: 468b4d3ad4bd88ef6404d571b84482394bba8d30 (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
36
/* { dg-do compile } */
/* { dg-options "-O2 -Wuninitialized" } */

enum demangle_component_type {
  DEMANGLE_COMPONENT_NAME,
  DEMANGLE_COMPONENT_REFERENCE
};
struct demangle_component {
  enum demangle_component_type type;
} d_print_comp_inner_mod_inner, *d_print_comp_inner_dc;
struct d_print_mod {
  struct d_print_mod *next;
};
struct d_print_info {
  int templates;
  struct d_print_mod *modifiers;
};
void d_print_comp_inner(struct d_print_info *dpi)
{
  int saved_templates, need_template_restore = 0;
  switch (d_print_comp_inner_dc->type) {
  case DEMANGLE_COMPONENT_NAME:
    goto modifier;
  case DEMANGLE_COMPONENT_REFERENCE:
    saved_templates = dpi->templates;
    need_template_restore = 1;
  modifier:
    struct d_print_mod dpm;
    dpm.next = dpi->modifiers;
    d_print_comp_inner_mod_inner = *d_print_comp_inner_dc;
    d_print_comp_inner(dpi);
    dpi->modifiers = dpm.next;
    if (need_template_restore)
      dpi->templates = saved_templates; /* { dg-bogus "uninitialized" } */
  }
}