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/66512] PRE fails to optimize calls to pure functions in C++, ok in C
Date: Thu, 18 Jun 2015 11:15:00 -0000	[thread overview]
Message-ID: <bug-66512-4-7pyJqpqKEf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66512-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Alexander Monakov from comment #2)
> In that case I'd like to contribute a documentation patch to make that clear
> in the pure/const attribute information, but I need more explanation.  I see
> that
> 
> int p(void) __attribute__((const));
> void f()
> {
>   p();
>   p();
> }
> 
> is optimized to an empty function, even though p may throw.  Is that not a
> bug?

I would say so.  But this has quite some implementation issues, also with...

> Also, could you please expand your explanation in the first paragraph, i.e.
> this:
> 
>   What we miss here is the fact that it should only matter
>   if p throws internally for IL consistency.  Of course it
>   still matters for observing other side-effects if p throws
>   and after the transform now does so before side-effects
>   that should be observed otherwise.
> 
> I'm probably missing a lot of contextual knowledge to understand that.  TIA.

... this, the side-effect ordering of stores and the throwing p() call is
not properly represented.


  parent reply	other threads:[~2015-06-18 11:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 15:06 [Bug tree-optimization/66512] New: " amonakov at gcc dot gnu.org
2015-06-14 10:36 ` [Bug tree-optimization/66512] " rguenth at gcc dot gnu.org
2015-06-15 10:33 ` amonakov at gcc dot gnu.org
2015-06-18 11:15 ` rguenth at gcc dot gnu.org [this message]
2020-11-24 23:44 ` i at maskray dot me

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-66512-4-7pyJqpqKEf@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).