OSDN Git Service

patch for PR rtl-optimization/25130
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / uninit-10.c
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.  */
6
7 struct operand_data
8 {
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;
19 };
20
21 struct data
22 {
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];
35 };
36
37 extern void message_with_line (int, const char *, ...)
38      __attribute__ ((__format__ (__printf__, 2, 3)));
39 extern int have_error;
40
41 extern char *strchr (__const char *__s, int __c) __attribute__ ((__pure__));
42
43 void
44 validate_insn_alternatives (d)
45      struct data *d;
46 {
47   int n = 0, start;
48
49   for (start = 0; start < d->n_operands; start++)
50     if (d->operand[start].n_alternatives > 0)
51       {
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;
57
58         for (p = d->operand[start].constraint; (c = *p); p += len)
59           {
60             len = 1;
61
62             if (len < 1 || (len > 1 && strchr (",#*+=&%!0123456789", c)))
63               {
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;
69               }
70
71             if (c == ',')
72               {
73                 which_alternative++;
74                 continue;
75               }
76
77             for (i = 1; i < len; i++)
78               if (p[i] == '\0')
79                 {
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;
85                 }
86               else if (strchr (",#*", p[i]))
87                 {
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;
92                 }
93           }
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)
99           {
100             message_with_line (d->lineno,
101                                "wrong number of alternatives in operand %d",
102                                start);
103             have_error = 1;
104           }
105       }
106
107
108   d->n_alternatives = n;
109 }