Add new test for PR65178.
gcc/testsuite/ChangeLog: PR tree-optimization/65178 * gcc.dg/uninit-pr65178.c: New test.
This commit is contained in:
parent
50f3ac1beb
commit
b362d7947b
1 changed files with 21 additions and 0 deletions
21
gcc/testsuite/gcc.dg/uninit-pr65178.c
Normal file
21
gcc/testsuite/gcc.dg/uninit-pr65178.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* PR tree-optimizatiom/65178 - incorrect -Wmaybe-uninitialized when using
|
||||
nested loops
|
||||
{ dg-do compile }
|
||||
{ dg-options "-O2 -Wall" } */
|
||||
|
||||
void *bar (int);
|
||||
|
||||
char *foo (void)
|
||||
{
|
||||
char *c = "bla";
|
||||
char *buf;
|
||||
for (int a = 1;; a = 0)
|
||||
{
|
||||
for (char *s = c; *s; ++s)
|
||||
{
|
||||
}
|
||||
if (!a) break;
|
||||
buf = (char *) bar (1);
|
||||
}
|
||||
return buf; // { dg-bogus "\\\[-Wmaybe-uninitialized" }
|
||||
}
|
Loading…
Add table
Reference in a new issue