public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aldyh at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/99919] [9/10/11/12 Regression] bogus -Wmaybe-uninitialized with a _Bool bit-field
Date: Tue, 30 Nov 2021 11:58:50 +0000 [thread overview]
Message-ID: <bug-99919-4-tXzCmc6igL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99919-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99919
Aldy Hernandez <aldyh at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aldyh at gcc dot gnu.org
--- Comment #3 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #1)
> The IL below shows there is enough information in the IL for the warning to
> determine that x_5 is never read from.
>
> void g (struct B b)
> {
> _Bool b$j;
> _Bool b$i;
> _Bool x;
> unsigned char _1;
> unsigned char _2;
> unsigned char _3;
> unsigned char _4;
>
> <bb 2> [local count: 1073741824]:
> b$i_11 = b.i;
> _1 = VIEW_CONVERT_EXPR<unsigned char>(b);
> _2 = _1 & 1;
> if (_2 != 0)
> goto <bb 4>; [50.00%]
> else
> goto <bb 3>; [50.00%]
>
> <bb 3> [local count: 536870912]:
>
> <bb 4> [local count: 1073741824]:
> # x_5 = PHI <x_8(D)(2), b$i_11(3)>
> # b$j_10 = PHI <0(2), b$i_11(3)>
> b.j = b$j_10;
> _3 = VIEW_CONVERT_EXPR<unsigned char>(b);
> _4 = _3 & 2;
> if (_4 != 0)
> goto <bb 5>; [50.00%]
> else
> goto <bb 6>; [50.00%]
>
> <bb 5> [local count: 536870913]:
> z = x_5;
>
> <bb 6> [local count: 1073741824]:
> return;
>
> }
The warning on the above IL seems legit.
x_5 is initialized from b$i_11 when b & 1 == 0, but the read from x_5 happens
when b & 2 != 0. So the set and the read are predicated on two different
things.
Maybe I'm missing some subtle bit field thing. Does setting b.j somehow alter
b.i?
next prev parent reply other threads:[~2021-11-30 11:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-05 20:29 [Bug tree-optimization/99919] New: [9/10/11 " msebor at gcc dot gnu.org
2021-04-05 20:51 ` [Bug tree-optimization/99919] " msebor at gcc dot gnu.org
2021-04-06 8:39 ` rguenth at gcc dot gnu.org
2021-04-08 14:22 ` rguenth at gcc dot gnu.org
2021-06-01 8:20 ` [Bug tree-optimization/99919] [9/10/11/12 " rguenth at gcc dot gnu.org
2021-11-30 11:58 ` aldyh at gcc dot gnu.org [this message]
2021-11-30 12:06 ` pinskia at gcc dot gnu.org
2021-11-30 14:22 ` aldyh at gcc dot gnu.org
2022-12-08 9:25 ` [Bug tree-optimization/99919] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-12-08 10:47 ` rguenth at gcc dot gnu.org
2023-04-26 6:55 ` [Bug tree-optimization/99919] [10/11/12/13/14 " rguenth at gcc dot gnu.org
2023-07-27 9:22 ` [Bug tree-optimization/99919] [11/12/13/14 " rguenth at gcc dot gnu.org
2023-12-15 13:33 ` rguenth at gcc dot gnu.org
2024-05-21 9:10 ` [Bug tree-optimization/99919] [11/12/13/14/15 " jakub 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-99919-4-tXzCmc6igL@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).