public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/78993] [9/10/11 Regression] False positive from -Wmaybe-uninitialized
Date: Thu, 01 Apr 2021 22:32:31 +0000 [thread overview]
Message-ID: <bug-78993-4-Qs0PVhZBYB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-78993-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78993
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|4.1.0, 5.3.0, 6.2.0, 7.0 |10.2.0, 11.0, 5.5.0, 6.4.0,
| |7.2.0, 8.3.0, 9.1.0
Last reconfirmed|2017-01-05 00:00:00 |2021-4-1
Summary|False positive from |[9/10/11 Regression] False
|-Wmaybe-uninitialized |positive from
| |-Wmaybe-uninitialized
--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
Reconfirmed with GCC 11 as a regression introduced in r219703 (GCC 5.0). The
warning for the smaller test case started with r147852 (GCC 4.5.0).
(In reply to Manuel López-Ibáñez from comment #5)
> (In reply to Andrew Pinski from comment #4)
> > # i_5 = PHI <i_3(D)(3), i_4(4)>
> > # j_27 = PHI <j_6(3), j_26(4)>
> > # prephitmp_7 = PHI <0(3), prephitmp_17(4)>
> > _14 = i_5 > 9;
> > _18 = prephitmp_7 | _14;
> > if (_18 != 0)
> > goto <bb 6>; [44.99%]
> > else
> > goto <bb 7>; [55.01%]
> >
> >
> > Most likely conditional warning does not understand the above case :).
>
> If the reason is the prephitmp_7 | _14, then this is PR42145
It doesn't understand it because it only deals with predicates of the form
<NAME> <OPERATOR> <CONSTANT> so when it sees (_18 != 0)" and tries to compare
it to another predicate it can only do it if the other one also involves _18
and that's not the case (there's only one _18 in the IL and that's this one).
But I don't think it should matter in this case because it seems clear in the
IL (as clear as anything can be) that j is undefined when (i < 0 && i > j)
holds and used when (i >= 0 && i < j) holds, and those two are mutually
exclusive. Yet when the warning logic tries to see if the predicate guarding
the definition of the variable is a superset of the one guarding its use is
winds up looking at:
def i_3(D) >= 0 && i_3(D) < j_6 (expanded)
AND (NOT (i_3(D) < 0), NOT (i_3(D) >= j_6))
use (prephitmp_7 | i_5 > 9) == 0 (expanded)
NOT (_17 != 0)
Here's GCC 11 IL for the small test case:
int foobar (int i)
{
int j;
int i;
int j;
int _1;
_Bool prephitmp_7;
_Bool _16;
_Bool _17;
_Bool prephitmp_20;
<bb 2> [local count: 1073741824]:
# .MEM_9 = VDEF <.MEM_2(D)>
j_6 = rand ();
if (i_3(D) >= j_6)
goto <bb 8>; [55.78%]
else
goto <bb 3>; [44.22%]
<bb 3> [local count: 474808632]:
if (i_3(D) < 0)
goto <bb 9>; [13.00%]
else
goto <bb 10>; [87.00%]
<bb 10> [local count: 413074919]:
goto <bb 5>; [100.00%]
<bb 9> [local count: 61733713]:
<bb 4> [local count: 273804168]:
# j_26 = PHI <j_6(9), j_12(D)(13)>
# prephitmp_20 = PHI <0(9), 1(13)>
# .MEM_10 = VDEF <.MEM_9>
i_4 = rand ();
<bb 5> [local count: 686879088]:
# i_5 = PHI <i_3(D)(10), i_4(4)>
# .MEM_8 = PHI <.MEM_9(10), .MEM_10(4)>
# j_27 = PHI <j_6(10), j_26(4)>
# prephitmp_7 = PHI <0(10), prephitmp_20(4)>
_16 = i_5 > 9;
_17 = prephitmp_7 | _16;
if (_17 != 0)
goto <bb 11>; [0.00%]
else
goto <bb 12>; [100.00%]
<bb 12> [local count: 686879088]:
goto <bb 7>; [100.00%]
<bb 11> [local count: 0]:
<bb 6> [local count: 386862736]:
# .MEM_11 = PHI <.MEM_8(11), .MEM_9(14)>
<bb 7> [local count: 1073741824]:
# _1 = PHI <0(6), j_27(12)>
# .MEM_25 = PHI <.MEM_11(6), .MEM_8(12)>
# VUSE <.MEM_25>
return _1;
<bb 8> [local count: 598933192]:
if (i_3(D) < 0)
goto <bb 13>; [35.41%]
else
goto <bb 14>; [64.59%]
<bb 14> [local count: 386862736]:
goto <bb 6>; [100.00%]
<bb 13> [local count: 212070456]:
goto <bb 4>; [100.00%]
}
next parent reply other threads:[~2021-04-01 22:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-78993-4@http.gcc.gnu.org/bugzilla/>
2021-04-01 22:32 ` msebor at gcc dot gnu.org [this message]
2021-04-08 14:24 ` rguenth at gcc dot gnu.org
2021-05-04 12:31 ` [Bug middle-end/78993] [9/10/11/12 " rguenth at gcc dot gnu.org
2021-06-01 8:08 ` rguenth at gcc dot gnu.org
2021-11-30 17:25 ` [Bug middle-end/78993] [9/10/11 " aldyh at gcc dot gnu.org
2022-05-27 9:36 ` [Bug middle-end/78993] [10/11 " rguenth at gcc dot gnu.org
2022-06-28 10:32 ` jakub at gcc dot gnu.org
2022-11-20 4:03 ` law at gcc dot gnu.org
2023-07-07 7:34 ` [Bug middle-end/78993] [11 " 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-78993-4-Qs0PVhZBYB@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).