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 middle-end/110228] [13/14 Regression] llvm-16 miscompiled due to an maybe uninitialized and optimizations saying that the uninitialized has a nonzero bits of 1.
Date: Tue, 20 Jun 2023 08:38:27 +0000	[thread overview]
Message-ID: <bug-110228-4-Xgo0GKlonD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110228-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110228

--- Comment #17 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #4)
> Phiopt does this:
> ```
> 	v_13 == 1 ? 1 : LookupFlags_6
> Matching expression match.pd:1990, gimple-match-5.cc:23
> Matching expression match.pd:1990, gimple-match-5.cc:23
> Matching expression match.pd:2479, gimple-match-4.cc:35
> Matching expression match.pd:2482, gimple-match-3.cc:66
> Matching expression match.pd:2489, gimple-match-2.cc:58
> Matching expression match.pd:1947, gimple-match-7.cc:20
> Applying pattern match.pd:4742, gimple-match-7.cc:15326
> Folded into the sequence:
> _17 = v_13 == 1;
> _18 = LookupFlags_6 | _17;
> Removing basic block 5
> ;; basic block 5, loop depth 1
> ;;  pred:       4
> ;;  succ:       6
> ```
> As zero_one_valued_p returns true for LookupFlags_6 because
> tree_nonzero_bits/get_nonzero_bits returns 1 for it.
> 
> So it is ranger in the end that returns that it has a nonzero bits of 1.
> Which is completely wrong as LookupFlags_6 is defined by:
>   # LookupFlags_6 = PHI <LookupFlags_9(D)(2), LookupFlags_5(5)>
> 
> 
> Which has an uninitialized variable in it which is not defined at what its
> value would be ....

BTW, it doesn't seem ranger would be involved here at all, since this bug
happens with -O1, and evrp nor VRP* run at this level.  The only other way
ranger could be involved at -O1 is through DOM threading's use of ranger, but
phiopt1 from which your dump above comes from, runs before DOM.

I realize further downthread y'all conclude this is an unitialized issue, but
I'm just trying to understand how ranger could have been involved.

FWIW, there are other passes which set global nonzero bits at -O1, most notably
CCP.  Theoretically any pass which calls set_range_info() or set_nonzero_bits()
would alter everyone's view of a range (strlen pass, PRE, DOM, sprintf, CCP,
etc).

And way down on the list of likely scenarios is fold_range() being called with
a global query object.  This would get ranger involved in folding something
with known global values (no additional lookups), but it's unlikely.  You
probably got a nonzero bits from some other pass.

  parent reply	other threads:[~2023-06-20  8:38 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 17:19 [Bug middle-end/110228] New: [14 Regression] llvm-16 miscompilation on small case switch, minimized slyfox at gcc dot gnu.org
2023-06-12 17:27 ` [Bug middle-end/110228] " pinskia at gcc dot gnu.org
2023-06-12 17:30 ` pinskia at gcc dot gnu.org
2023-06-12 17:32 ` pinskia at gcc dot gnu.org
2023-06-12 17:39 ` pinskia at gcc dot gnu.org
2023-06-12 17:45 ` pinskia at gcc dot gnu.org
2023-06-12 17:49 ` pinskia at gcc dot gnu.org
2023-06-12 19:03 ` [Bug middle-end/110228] [14 Regression] llvm-16 miscompiled due to an maybe uninitialized and optimizations saying that the uninitialized has a nonzero bits of 1 pinskia at gcc dot gnu.org
2023-06-12 19:17 ` pinskia at gcc dot gnu.org
2023-06-15  4:50 ` pinskia at gcc dot gnu.org
2023-06-16 22:18 ` pinskia at gcc dot gnu.org
2023-06-16 22:23 ` pinskia at gcc dot gnu.org
2023-06-17 17:52 ` pinskia at gcc dot gnu.org
2023-06-17 20:52 ` pinskia at gcc dot gnu.org
2023-06-17 20:56 ` slyfox at gcc dot gnu.org
2023-06-17 21:04 ` jakub at gcc dot gnu.org
2023-06-17 21:38 ` [Bug middle-end/110228] [13/14 " pinskia at gcc dot gnu.org
2023-06-20  8:38 ` aldyh at gcc dot gnu.org [this message]
2023-06-24  0:01 ` [Bug middle-end/110228] [13/14 Regression] llvm-16 miscompiled due to an maybe uninitialized variable pinskia at gcc dot gnu.org
2023-06-30  2:19 ` pinskia at gcc dot gnu.org
2023-07-01  5:24 ` pinskia at gcc dot gnu.org
2023-07-01 21:37 ` zhendong.su at inf dot ethz.ch
2023-07-01 21:40 ` pinskia at gcc dot gnu.org
2023-07-01 21:50 ` pinskia at gcc dot gnu.org
2023-07-03 21:04 ` slyfox at gcc dot gnu.org
2023-07-03 21:52 ` slyfox at gcc dot gnu.org
2023-07-04  6:33 ` rguenth at gcc dot gnu.org
2023-07-04  6:54 ` rguenth at gcc dot gnu.org
2023-07-04  9:15 ` cvs-commit at gcc dot gnu.org
2023-07-04  9:18 ` rguenth at gcc dot gnu.org
2023-07-04 10:06 ` zhendong.su at inf dot ethz.ch
2023-07-04 10:28 ` rguenth at gcc dot gnu.org
2023-07-04 13:36 ` slyfox at gcc dot gnu.org
2023-07-04 13:41 ` rguenther at suse dot de
2023-07-04 15:11 ` slyfox at gcc dot gnu.org
2023-07-05  7:29 ` [Bug middle-end/110228] [13 " rguenth at gcc dot gnu.org
2023-07-05  8:23 ` cvs-commit at gcc dot gnu.org
2023-07-05  8:24 ` 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-110228-4-Xgo0GKlonD@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).