Commit b6505b42 by Zack Weinberg

Tests for various kinds of spurious uninit variable warning.

`
Tests for various kinds of spurious uninit variable warning.
All are derived from cpplib; see comments in the files.

From-SVN: r25711
parent 85eb94a0
/* Spurious uninit variable warnings, case 3.
Inspired by cppexp.c (parse_charconst) */
/* { dg-do compile } */
/* { dg-options "-O -Wuninitialized" } */
extern void error (char *);
int
parse_charconst (const char *start, const char *end)
{
int c; /* { dg-bogus "c" "uninitialized variable warning" { xfail *-*-* } } */
int nchars, retval;
nchars = 0;
retval = 0;
while (start < end)
{
c = *start++;
if (c == '\'')
break;
nchars++;
retval += c;
retval <<= 8;
}
if (nchars == 0)
return 0;
if (c != '\'')
error ("malformed character constant");
return retval;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment