PR c++/82069 - ICE with lambda in template
[official-gcc.git] / gcc / testsuite / gcc.dg / uninit-10.c
blob0d62020df9f5871f74edc3535ad5193d361c4f67
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wall" } */
3 /* On Alpha EV4, dead code elimination and cfg simplification conspired
4 to leave the register containing 'C' marked live, though all references
5 to the variable had been removed. */
7 struct operand_data
9 struct operand_data *next;
10 int index;
11 const char *predicate;
12 const char *constraint;
13 int mode;
14 unsigned char n_alternatives;
15 char address_p;
16 char strict_low;
17 char eliminable;
18 char seen;
21 struct data
23 struct data *next;
24 const char *name;
25 const char *template;
26 int code_number;
27 int index_number;
28 int lineno;
29 int n_operands;
30 int n_dups;
31 int n_alternatives;
32 int operand_number;
33 int output_format;
34 struct operand_data operand[40];
37 extern void message_with_line (int, const char *, ...)
38 __attribute__ ((__format__ (__printf__, 2, 3)));
39 extern int have_error;
41 extern char *strchr (__const char *__s, int __c) __attribute__ ((__pure__));
43 void
44 validate_insn_alternatives (d)
45 struct data *d;
47 int n = 0, start;
49 for (start = 0; start < d->n_operands; start++)
50 if (d->operand[start].n_alternatives > 0)
52 int len, i;
53 const char *p;
54 char c; /* { dg-bogus "used uninitialized" "uninitialized variable warning" } */
55 int which_alternative = 0;
56 int alternative_count_unsure = 0;
58 for (p = d->operand[start].constraint; (c = *p); p += len)
60 len = 1;
62 if (len < 1 || (len > 1 && strchr (",#*+=&%!0123456789", c)))
64 message_with_line (d->lineno,
65 "invalid length %d for char '%c' in alternative %d of operand %d",
66 len, c, which_alternative, start);
67 len = 1;
68 have_error = 1;
71 if (c == ',')
73 which_alternative++;
74 continue;
77 for (i = 1; i < len; i++)
78 if (p[i] == '\0')
80 message_with_line (d->lineno,
81 "NUL in alternative %d of operand %d",
82 which_alternative, start);
83 alternative_count_unsure = 1;
84 break;
86 else if (strchr (",#*", p[i]))
88 message_with_line (d->lineno,
89 "'%c' in alternative %d of operand %d",
90 p[i], which_alternative, start);
91 alternative_count_unsure = 1;
94 if (alternative_count_unsure)
95 have_error = 1;
96 else if (n == 0)
97 n = d->operand[start].n_alternatives;
98 else if (n != d->operand[start].n_alternatives)
100 message_with_line (d->lineno,
101 "wrong number of alternatives in operand %d",
102 start);
103 have_error = 1;
108 d->n_alternatives = n;