This is the mail archive of the gcc-patches@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]

Re: [PATCH] Fix for PR51879 - Missed tail merging with non-const/pure calls


On Wed, Apr 25, 2012 at 11:57:09AM +0200, Richard Guenther wrote:
> void *foo ()
> {
>   return __builtin_return_address (0);
> }
> 
> void *bar (_Bool b)
> {
>   if (b)
>     return foo ();
>   else
>     return foo ();
> }
> 
> int main()
> {
>   if (bar(true) == bar(false))
>     abort ();
> }
> 
> ok ... outside of the scope of standard "C", but we certainly _can_ do this.
> Which would question tail-merging the above at all, of course.

I don't think we guarantee the above, after all, even pure functions may
use __builtin_return_address (0) - it doesn't modify memory, and we happily
remove pure calls, CSE the return values etc.

	Jakub


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