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 middle-end/65686] [5/6 regression] inconsistent warning maybe-uninitialized: warn about 'unsigned', not warn about 'int'
Date: Wed, 15 Apr 2015 07:46:00 -0000	[thread overview]
Message-ID: <bug-65686-4-feOQbdnfR9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65686-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic,
                   |                            |missed-optimization
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-04-15
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Target Milestone|---                         |5.2
     Ever confirmed|0                           |1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's (good)

  <bb 2>:
  _4 = e_3(D)->pu;
  if (&x != _4)
    goto <bb 3>;
  else
    goto <bb 5>;

  <bb 5>:
  goto <bb 4>;

  <bb 3>:
  _5 = MEM[(char * {ref-all})_4];
  MEM[(char * {ref-all})&x] = _5;

  <bb 4>:
  _7 = x;
  x ={v} {CLOBBER};
  return _7;

vs. (bad)

  <bb 2>:
  _4 = e_3(D)->pu;
  if (&x != _4)
    goto <bb 4>;
  else
    goto <bb 3>;

  <bb 3>:
  pretmp_9 = x;
  goto <bb 5>;

  <bb 4>:
  _5 = MEM[(char * {ref-all})_4];

  <bb 5>:
  # prephitmp_10 = PHI <pretmp_9(3), _5(4)>
  x ={v} {CLOBBER};
  return prephitmp_10;

that's a missed PRE opportunity in the good case (not sure why we use
unsigned int for the memcpy inlining - ah, because it goes the new
single load/store case in gimple_fold_builtin_memory_op).  PRE should
still be able to handle.

Only after PRE we hit the very special case where uninit warns about memory
reads (no store before the reads).  For this case inconsistencies are
very much expected...

But the testcase also shows a missed optimization opportunity because
&x can never be equal to e->pu (PR13962).


  parent reply	other threads:[~2015-04-15  7:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07 12:25 [Bug middle-end/65686] New: incorrect warning maybe-uninitialized dimhen at gmail dot com
2015-04-14 11:14 ` [Bug middle-end/65686] [4.9 regression] inconsistent warning maybe-uninitialized: warn about 'unsigned', not warn about 'int' dimhen at gmail dot com
2015-04-14 18:36 ` [Bug middle-end/65686] [5/6 " dimhen at gmail dot com
2015-04-15  7:46 ` rguenth at gcc dot gnu.org [this message]
2015-06-18 11:50 ` rguenth at gcc dot gnu.org
2015-06-18 12:09 ` dimhen at gmail dot com
2015-06-30 10:17 ` rguenth at gcc dot gnu.org
2015-07-16  9:11 ` rguenth at gcc dot gnu.org
2024-05-16 12:47 ` [Bug middle-end/65686] [5/6/7 " 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-65686-4-feOQbdnfR9@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).