]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR middle-end/86058 - TARGET_MEM_REF causing incorrect message for -Wmaybe-uninitiali...
authorMartin Sebor <msebor@redhat.com>
Tue, 13 Apr 2021 19:46:21 +0000 (13:46 -0600)
committerMartin Sebor <msebor@redhat.com>
Tue, 13 Apr 2021 19:46:21 +0000 (13:46 -0600)
gcc/testsuite/ChangeLog:
PR middle-end/86058
* gcc.dg/pr86058.c: New test.

gcc/testsuite/gcc.dg/pr86058.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/pr86058.c b/gcc/testsuite/gcc.dg/pr86058.c
new file mode 100644 (file)
index 0000000..0b030b0
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR middle-end/86058 - TARGET_MEM_REF causing incorrect message for
+   -Wmaybe-uninitialized warning
+   { dg-do compile } 
+   { dg-options "-O2 -Wuninitialized -Wmaybe-uninitialized" } */
+    
+extern void foo (int *);
+
+void zip (int *out, int indx)
+{
+  int arr[10];
+
+  for (int i = 0; i < indx; ++i)
+    out[i] = arr[i] + 1;  // { dg-warning "'arr\\\[i]' may be used uninitialized" "pr?????" { xfail *-*-* } }
+                          // { dg-warning "'arr' may be used uninitialized" "actual" { target *-*-* } .-1 }
+  
+  foo (arr);
+  foo (out);
+}