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/109561] -Wmaybe-uninitialized false positive with std::optional
Date: Thu, 20 Apr 2023 07:09:05 +0000	[thread overview]
Message-ID: <bug-109561-4-HSTERAm3Xi@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109561-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
We diagnose

<bb7>
pretmp_108 = MEM[(const struct basic_string *)&D.58534 + 8B]._M_string_length;

which is guarded by


<bb 5> [local count: 955630225]:
# ivtmp.123_51 = PHI <ivtmp.123_74(34), ivtmp.123_42(4)>
MEM[(struct optional *)&D.58534] ={v} {CLOBBER};
MEM[(union _Storage *)&D.58534] ={v} {CLOBBER};
MEM[(struct _Optional_payload_base *)&D.58534]._M_engaged = 0;
MEM[(struct optional *)&D.58534 + 8B] ={v} {CLOBBER};
MEM[(union _Storage *)&D.58534 + 8B] ={v} {CLOBBER};
MEM[(struct _Optional_payload_base *)&D.58534 + 8B]._M_engaged = 0;
_1 = (void *) ivtmp.123_51;
MEM[(struct optional *)_1 + -24B] = D.58534.i;
_23 = MEM[(bool *)_1 + 16B];
if (_23 != 0)
  goto <bb 6>; [50.00%]
else
  goto <bb 22>; [50.00%]

<bb 6> [local count: 477815112]:
_24 = MEM[(struct _Optional_payload_base &)&D.58534 + 8]._M_engaged;
pretmp_110 = MEM[(char * *)_1 + -16B];
if (_24 != 0)
  goto <bb 7>; [33.00%]
else
  goto <bb 21>; [67.00%]

clearly there's missed CSE of .M_engaged here, but

  MEM[(struct optional *)_1 + -24B] = D.58534.i;

must aliases the location.

  parent reply	other threads:[~2023-04-20  7:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20  1:34 [Bug c++/109561] New: -Wmaybe-uninitialized false positive false positive false positive false positive false positive f.heckenbach@fh-soft.de
2023-04-20  6:55 ` [Bug tree-optimization/109561] -Wmaybe-uninitialized false positive with std::optional rguenth at gcc dot gnu.org
2023-04-20  7:09 ` rguenth at gcc dot gnu.org [this message]
2024-05-24  1:44 ` sjames 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-109561-4-HSTERAm3Xi@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).