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/80548] -Wmaybe-uninitialized false positive when an assignment is added
Date: Tue, 30 Nov 2021 14:09:52 +0000	[thread overview]
Message-ID: <bug-80548-4-ugOJHALOI9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-80548-4@http.gcc.gnu.org/bugzilla/>

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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldyh at gcc dot gnu.org,
                   |                            |amacleod at redhat dot com,
                   |                            |law at gcc dot gnu.org

--- Comment #3 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
I think we should start thinking of any Wuninitialized warnings in terms of
missed threads, at least initially.  Jeff has mentioned this in the past, an
I'm slowly being converted.  I mean, not that there aren't problems in the
uninit code, but we should at least check that there are no missing threads.

The problematic read from x is in BB5:

  <bb 5> [local count: 55807731]:
  h (x_17, y_2);
  y_16 = g ();
  goto <bb 7>; [100.00%]

On paths starting on 2->3 x_17 is defined, whereas on paths starting on 2->6
x_17 is undefined:

  <bb 6> [local count: 59055799]:
  # x_17 = PHI <x_10(3), x_6(D)(2)>

Looking at the last threader (threadfull2) before the uninit pass we see boths
paths are registered for threading:

  [3] Registering jump thread: (3, 6) incoming edge;  (6, 7) normal (7, 8)
normal (8, 4) normal (4, 5) nocopy; 

  [4] Registering jump thread: (2, 6) incoming edge;  (6, 7) normal (7, 8)
normal (8, 4) normal (4, 10) nocopy; 

However, there were no threaded paths in the entire compilation:

$ grep thread a.c.338t.statistics 
$

So sometime between registering the path for threading and the lowlevel BB
copier, we dropped the threads.

The culprit is duplicate_thread_path in the generic bits:

      /* We do not handle subloops, i.e. all the blocks must belong to the
         same loop.  */
      if (region[i]->loop_father != loop)
        return false;

This is an area I'm unfamiliar with, but it seems we should be able to thread
this when loop optimizations are done.

And indeed, if we allow this when loop_done, no warning is emitted.

  parent reply	other threads:[~2021-11-30 14:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-80548-4@http.gcc.gnu.org/bugzilla/>
2021-04-13 23:56 ` [Bug middle-end/80548] " msebor at gcc dot gnu.org
2021-11-30 14:09 ` aldyh at gcc dot gnu.org [this message]
2021-11-30 14:20 ` [Bug tree-optimization/80548] " aldyh at gcc dot gnu.org
2021-11-30 14:38 ` aldyh at gcc dot gnu.org
2021-12-01 16:03 ` aldyh at gcc dot gnu.org
2022-11-20  4:05 ` law at gcc dot gnu.org
2022-11-21  9:59 ` vincent-gcc at vinc17 dot net
2022-11-21 14:40 ` law at gcc dot gnu.org
2022-11-22 10:07 ` vincent-gcc at vinc17 dot net
2022-11-22 13:10 ` law at gcc dot gnu.org
2022-11-23 16:46 ` vincent-gcc at vinc17 dot net

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-80548-4-ugOJHALOI9@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).