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/105705] [12/13 Regression] std::equal triggers incorrect -Wnonnull warning
Date: Tue, 24 May 2022 07:23:38 +0000	[thread overview]
Message-ID: <bug-105705-4-bVB5LQ2hJi@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105705-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-05-24
           Priority|P3                          |P2

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> if (_14 != _15)
>     goto <bb 19>; [50.00%]
>   else
>     goto <bb 16>; [50.00%]
> 
> ...
> 
>   <bb 16> [local count: 507317172]:
>   _50 = _15 - _14;
>   if (_50 != 0)
>     goto <bb 17>; [50.00%]
>   else
>     goto <bb 18>; [50.00%]
> 
>   <bb 17> [local count: 253658586]:
>   _51 = (long unsigned int) _50;
>   _52 = __builtin_memcmp (_14, 0B, _51);
>   _53 = _52 == 0;
> 
>   <bb 18> [local count: 507317172]:
>   # _54 = PHI <1(16), _53(17)>
> 
> 
> The function call is in an unreachable basic block.
> 
> Since _15 == _14 holds true in bb16, _50 == 0 will hold true. so bb 17 is
> never entered.
> Looks like a pass ordering issue ...

All ranger, DOM and VN know this trick though...

We warn from post_ipa_warn here, not sure why.  The late diagnostics code
is spread all over the place which makes it not sensible places :/
It seems this is _specifically_ for -Wnonnull.

Jakub - do you remember why you added the pass at this point, right after
inlining but before scalar cleanup gets the chance to remove dead code?

The memcmp is gone after 112.fre3, there's

      NEXT_PASS (pass_post_ipa_warn);
      /* Must run before loop unrolling.  */
      NEXT_PASS (pass_warn_access, /*early=*/true);
      NEXT_PASS (pass_complete_unrolli);
      NEXT_PASS (pass_backprop);
      NEXT_PASS (pass_phiprop);
      NEXT_PASS (pass_forwprop);
      /* pass_build_alias is a dummy pass that ensures that we
         execute TODO_rebuild_alias at this point.  */
      NEXT_PASS (pass_build_alias);
      NEXT_PASS (pass_return_slot);
      NEXT_PASS (pass_fre, true /* may_iterate */);

  parent reply	other threads:[~2022-05-24  7:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 19:04 [Bug libstdc++/105705] New: " derek.mauro at gmail dot com
2022-05-23 19:11 ` [Bug tree-optimization/105705] [12/13 Regression] " pinskia at gcc dot gnu.org
2022-05-24  7:23 ` rguenth at gcc dot gnu.org [this message]
2022-05-24  7:30 ` jakub at gcc dot gnu.org
2022-05-24  7:40 ` jakub at gcc dot gnu.org
2022-05-24  8:53 ` redi at gcc dot gnu.org
2022-05-24  8:58 ` redi at gcc dot gnu.org
2022-05-24  9:37 ` rguenther at suse dot de
2023-05-08 12:24 ` [Bug tree-optimization/105705] [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-105705-4-bVB5LQ2hJi@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).