aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2021-07-22 11:49:33 -0600
committerMartin Sebor <msebor@redhat.com>2021-07-22 11:51:26 -0600
commitb362d7947b37059fdb6de62145fa5146258dd58f (patch)
tree2cd2ded5c1a723557074f2b3bd040e20f83d02e7 /gcc
parent50f3ac1beb0cb400484dd2621dd0e3e530583e69 (diff)
downloadgcc-b362d7947b37059fdb6de62145fa5146258dd58f.zip
gcc-b362d7947b37059fdb6de62145fa5146258dd58f.tar.gz
gcc-b362d7947b37059fdb6de62145fa5146258dd58f.tar.bz2
Add new test for PR65178.
gcc/testsuite/ChangeLog: PR tree-optimization/65178 * gcc.dg/uninit-pr65178.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr65178.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/uninit-pr65178.c b/gcc/testsuite/gcc.dg/uninit-pr65178.c
new file mode 100644
index 0000000..21eb354
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr65178.c
@@ -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" }
+}