This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/66512] PRE fails to optimize calls to pure functions in C++, ok in C


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Because p may throw.  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.  Consider


 for (;;)
   {
     printf("foo");
     g(p())
   }

and p throwing.

So you miss a nothrow attribute or a throw() specification here.  const
does _not_ imply nothrow.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]