public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/56654] New: uninit warning behaves erratically
Date: Mon, 18 Mar 2013 13:38:00 -0000 [thread overview]
Message-ID: <bug-56654-4@http.gcc.gnu.org/bugzilla/> (raw)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56654
Bug #: 56654
Summary: uninit warning behaves erratically
Classification: Unclassified
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: rguenth@gcc.gnu.org
CC: xinliangli@gmail.com
For c-c++-common/uninit-17.c we currently expect the uninit use at:
static void bar(int a, int *ptr)
{
do
{
int b; /* { dg-message "declared" } */
if (b < 40) {
ptr[0] = b;
}
b += 1; /* { dg-warning "may be used uninitialized" } */
ptr++;
}
while (--a != 0);
}
where I would expect it at the if stmt. Now, when I exchange the late
DOM and the late VRP passes I instead get the warning two lines earlier
(inside the guarded BB). But there is no change in the IL:
> diff -u a/uninit-17.c.131t.uninit1 b/uninit-17.c.131t.uninit1
--- a/uninit-17.c.131t.uninit1 2013-03-18 14:27:16.677116283 +0100
+++ b/uninit-17.c.131t.uninit1 2013-03-18 14:26:58.956922876 +0100
@@ -3,7 +3,13 @@
[WORKLIST]: add to initial list: b_5 = PHI <b_13(D)(2), b_7(6)>
[CHECK]: examining phi: b_5 = PHI <b_13(D)(2), b_7(6)>
-[CHECK]: Found unguarded use: b_7 = b_5 + 1;
+
+Use in stmt *ptr_6 = b_5;
+is guarded by :
+if (b_5 <= 39)
+
+[CHECK] Found def edge 1 in b_5 = PHI <b_13(D)(2), b_7(6)>
+[CHECK]: Found unguarded use: *ptr_6 = b_5;
void foobar(int, int*) (int a, int * ptr)
{
int b;
the only difference is in the order of b_5 immediate uses.
That is, find_uninit_use should impose an ordering when walking over
immediate uses - for example visit the most dominating use first.
next reply other threads:[~2013-03-18 13:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-18 13:38 rguenth at gcc dot gnu.org [this message]
2014-09-11 22:14 ` [Bug tree-optimization/56654] " manu at gcc dot gnu.org
2021-03-26 16:41 ` [Bug tree-optimization/56654] uninit warning behaves erratically (always executed block, "is" vs "may", order when walking uses) msebor at gcc dot gnu.org
2022-08-29 14:09 ` rguenth at gcc dot gnu.org
2022-08-30 7:33 ` cvs-commit at gcc dot gnu.org
2022-08-30 7:33 ` rguenth at gcc dot gnu.org
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=bug-56654-4@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@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).