Add new test for PR65178.

gcc/testsuite/ChangeLog:
	PR tree-optimization/65178
	* gcc.dg/uninit-pr65178.c: New test.
This commit is contained in:
Martin Sebor 2021-07-22 11:49:33 -06:00
parent 50f3ac1beb
commit b362d7947b

View 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" }
}