public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Sebor <msebor@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-8161] PR middle-end/86058 - TARGET_MEM_REF causing incorrect message for -Wmaybe-uninitialized warning
Date: Tue, 13 Apr 2021 19:48:31 +0000 (GMT)	[thread overview]
Message-ID: <20210413194831.790EE3951CA4@sourceware.org> (raw)

https://gcc.gnu.org/g:8084ab15a3e300e3b2c537e56e0f3a1b00778aec

commit r11-8161-g8084ab15a3e300e3b2c537e56e0f3a1b00778aec
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Apr 13 13:46:21 2021 -0600

    PR middle-end/86058 - TARGET_MEM_REF causing incorrect message for -Wmaybe-uninitialized warning
    
    gcc/testsuite/ChangeLog:
            PR middle-end/86058
            * gcc.dg/pr86058.c: New test.

Diff:
---
 gcc/testsuite/gcc.dg/pr86058.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/pr86058.c b/gcc/testsuite/gcc.dg/pr86058.c
new file mode 100644
index 00000000000..0b030b04acf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr86058.c
@@ -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);
+}


                 reply	other threads:[~2021-04-13 19:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210413194831.790EE3951CA4@sourceware.org \
    --to=msebor@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).