public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/95558] [9/10/11/12 Regression] Invalid IPA optimizations based on weak definition
Date: Mon, 17 Jan 2022 22:20:51 +0000	[thread overview]
Message-ID: <bug-95558-4-kXtpVlit7K@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95558-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Rich Felker from comment #11)
> Are you sure? If pure/const discovery is no longer applied to weak
> definitions, it shouldn't be able to propagate to a non-inlined caller. Of
> course the fix may be incomplete or not working, which I guess we could tell
> from whether it happened prior to or after comment 5. :)

There still looks like there is a bug as shown by taking the original testcase
in comment #0 and using -O2 -fno-inline, you will get:

reclaim_gaps:
        ret
...
foo:
        ret

Which is still wrong as reclaim should not be considered as pure.

>From *.pure-const:

Starting cycle
  Visiting donate_dummy/0 state:const looping 0
Result const looping 0
Function found not to call free: donate_dummy/0
Starting cycle
  Visiting reclaim/2 state:pure looping 0
    Call to __malloc_donate/1 const
Result pure looping 0
Function found to be pure: reclaim/2
Declaration updated to be pure: reclaim/2
Starting cycle
  Visiting reclaim_gaps/3 state:pure looping 0
    Call to reclaim/2 state:pure looping:0
    Call to reclaim/2 state:pure looping:0
Result pure looping 0
Function found to be pure: reclaim_gaps/3
Declaration updated to be pure: reclaim_gaps/3
Starting cycle
  Visiting foo/4 state:const looping 0
    Call to reclaim_gaps/3 state:pure looping:0
Result pure looping 0
Function found to be pure: foo/4
Declaration updated to be pure: foo/4

reclaim, reclaim_gaps and foo are all found as pure. without -fno-inline, we
get some early inlining which causes the difference there.

  parent reply	other threads:[~2022-01-17 22:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-06  3:45 [Bug middle-end/95558] New: " bugdal at aerifal dot cx
2020-06-06  8:01 ` [Bug ipa/95558] " amonakov at gcc dot gnu.org
2020-06-06 14:36 ` bugdal at aerifal dot cx
2020-06-06 14:40 ` bugdal at aerifal dot cx
2020-06-09  6:47 ` rguenth at gcc dot gnu.org
2021-09-22  5:59 ` [Bug ipa/95558] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2022-01-17 15:08 ` rguenth at gcc dot gnu.org
2022-01-17 16:33 ` bugdal at aerifal dot cx
2022-01-17 17:32 ` hubicka at kam dot mff.cuni.cz
2022-01-17 17:44 ` bugdal at aerifal dot cx
2022-01-17 19:15 ` amonakov at gcc dot gnu.org
2022-01-17 22:05 ` bugdal at aerifal dot cx
2022-01-17 22:20 ` pinskia at gcc dot gnu.org [this message]
2022-01-17 23:54 ` hubicka at kam dot mff.cuni.cz
2022-01-21 13:31 ` rguenth at gcc dot gnu.org
2022-05-27  9:42 ` [Bug ipa/95558] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:41 ` jakub at gcc dot gnu.org
2023-01-19 13:12 ` rguenth at gcc dot gnu.org
2023-07-07 10:37 ` [Bug ipa/95558] [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-95558-4-kXtpVlit7K@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).