2014-07-29 Ed Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / gcc / testsuite / gcc.dg / uninit-3.c
blobac5bfec8e72dbc91d554f6a44d62c75cce76f4e8
1 /* Spurious uninit variable warnings, case 3.
2 Inspired by cppexp.c (parse_charconst) */
3 /* { dg-do compile } */
4 /* { dg-options "-O -Wuninitialized" } */
6 extern void error (char *);
8 int
9 parse_charconst (const char *start, const char *end)
11 int c; /* { dg-bogus "c" "uninitialized variable warning" } */
12 int nchars, retval;
14 nchars = 0;
15 retval = 0;
16 while (start < end)
18 c = *start++;
19 if (c == '\'')
20 break;
21 nchars++;
22 retval += c;
23 retval <<= 8;
26 if (nchars == 0)
27 return 0;
29 if (c != '\'')
30 error ("malformed character constant");
32 return retval;