public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/89976] [9/10/11 Regression] missing -Wuninitialized for struct member due to sra and TREE_NO_WARNING
Date: Fri, 16 Apr 2021 21:30:55 +0000	[thread overview]
Message-ID: <bug-89976-4-DPWdBsvoLV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-89976-4@http.gcc.gnu.org/bugzilla/>

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |tree-optimization
            Summary|missing uninitialized       |[9/10/11 Regression]
                   |warning for uninitialized   |missing -Wuninitialized for
                   |struct member (VOPs)        |struct member due to sra
                   |                            |and TREE_NO_WARNING
   Last reconfirmed|2019-11-02 00:00:00         |2021-4-16
                 CC|                            |msebor at gcc dot gnu.org
      Known to fail|                            |10.2.0, 11.0, 4.5.3, 4.6.4,
                   |                            |4.9.4, 5.5.0, 6.4.0, 7.2.0,
                   |                            |8.3.0, 9.1.0

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
In all cases and with -O1 and above, the uninitialized read is clearly visible
in the IL but it's suppressed because the variable (such as x$x in case 1) has
the TREE_NO_WARNING bit set.  This appears to be regression introduced in GCC
4.5 in r147980.

gcc -O1 -S -Wall -std=c++14 -fdump-tree-uninit=/dev/stdout pr89976.C 

;; Function foo (_Z3foov, funcdef_no=3, decl_uid=2098, cgraph_uid=4,
symbol_order=3)

struct X foo ()
{
  int x$x;                             <<< TREE_NO_WARNING == 1
  struct X D.2133;

  <bb 2> [local count: 1073741824]:
  D.2133.x = x$x_2(D);                 <<< uninitialized read
  D.2133.y = 0;
  return D.2133;

}



;; Function main (main, funcdef_no=4, decl_uid=2129, cgraph_uid=5,
symbol_order=4) (executed once)

int main ()
{
  int x$x;                             <<< TREE_NO_WARNING == 1
  struct X D.2156;
  struct X x;

  <bb 2> [local count: 1073741824]:
  x ={v} {CLOBBER};
  return x$x_5(D);                     <<< uninitialized read

}

  parent reply	other threads:[~2021-04-16 21:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-89976-4@http.gcc.gnu.org/bugzilla/>
2020-06-23 21:03 ` [Bug c++/89976] missing uninitialized warning for uninitialized struct member (VOPs) msebor at gcc dot gnu.org
2021-04-01 23:10 ` msebor at gcc dot gnu.org
2021-04-16 21:30 ` msebor at gcc dot gnu.org [this message]
2021-04-19  7:20 ` [Bug tree-optimization/89976] [9/10/11 Regression] missing -Wuninitialized for struct member due to sra and TREE_NO_WARNING rguenth at gcc dot gnu.org
2021-06-01  8:13 ` [Bug tree-optimization/89976] [9/10/11/12 " rguenth at gcc dot gnu.org
2021-06-26 15:17 ` egallager at gcc dot gnu.org
2021-06-28 20:06 ` msebor at gcc dot gnu.org
2022-05-27  9:40 ` [Bug tree-optimization/89976] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:37 ` jakub at gcc dot gnu.org
2023-07-07 10:35 ` [Bug tree-optimization/89976] [11/12/13/14 " 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-89976-4-DPWdBsvoLV@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).