public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/105937] [12 Regression] maybe-uninitialized with std::optional
Date: Tue, 11 Oct 2022 12:06:44 +0000	[thread overview]
Message-ID: <bug-105937-4-LrUNQTZy21@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105937-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:627132c9bf9439bf0ac83bb092182055c1e0f3ab

commit r12-8818-g627132c9bf9439bf0ac83bb092182055c1e0f3ab
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Aug 19 14:12:52 2022 +0200

    tree-optimization/105937 - avoid uninit diagnostics crossing iterations

    The following avoids adding PHIs to the worklist for uninit processing
    if we reach them following backedges.  That confuses predicate analysis
    because it assumes the use is happening in the same iteration as the the
    definition.  For the testcase in the PR the situation is like

    void foo (int val)
    {
      int uninit;
      # val = PHI <..> (B)
      for (..)
        {
          if (..)
            {
              .. = val; (C)
              val = uninit;
            }
          # val = PHI <..> (A)
        }
    }

    and starting from (A) with 'uninit' as argument we arrive at (B)
    and from there at (C).  Predicate analysis then tries to prove
    the predicate of (B) (not the backedge) can prove that the
    path from (B) to (C) is unreachable which isn't really what it
    necessary - that's what we'd need to do when the preheader
    edge of the loop were the edge with the uninitialized def.

    So the following makes those cases intentionally false negatives.

            PR tree-optimization/105937
            * tree-ssa-uninit.cc (find_uninit_use): Do not queue PHIs
            on backedges.
            (execute_late_warn_uninitialized): Mark backedges.

            * g++.dg/uninit-pr105937.C: New testcase.

    (cherry picked from commit c77fae1ca796d6ea06d5cd437909905c3d3d771c)

  parent reply	other threads:[~2022-10-11 12:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-12 22:12 [Bug c++/105937] New: [12] Regression with maybe-uninitialized janisozaur+gcc at gmail dot com
2022-06-12 22:16 ` [Bug tree-optimization/105937] " pinskia at gcc dot gnu.org
2022-06-12 22:25 ` [Bug tree-optimization/105937] [12/13 Regression] maybe-uninitialized with std::optional pinskia at gcc dot gnu.org
2022-10-11 12:06 ` cvs-commit at gcc dot gnu.org [this message]
2022-10-11 12:08 ` [Bug tree-optimization/105937] [12 " 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-105937-4-LrUNQTZy21@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).