[PATCH] Fix PR middle-end/11151

Jim Wilson wilson@specifixinc.com
Fri Dec 5 02:11:00 GMT 2003


Eric Botcazou wrote:
> This is the second part of the fix for this PR, which deals this time with 
> __builtin_return (the first part dealt with __builtin_apply).

I think there is a historical error here allowing anyone to use 
__builtin_return.  It was implemented for a specific purpose, to 
implement an Objective-C language feature.  Allowing end users to use it 
however complicates the matter, becuase then, like any other language 
extension, we have to define how this interacts with all other language 
features, and it gets much more complicated than it was ever meant to 
be.  I think the same is true for almost all builtin functions.

Adding a new naked_return_label looks like a reasonable solution to me, 
but there are some complications.  I think it will break: destructors, 
profiling, EH, alloca.  It probably also breaks other features I didn't 
happen to think of while writing this message.  This is all fine for 
libobjc/sendmsg.c, but it creates a documentation problem for the end 
user.  How do we define the exact circumstances when builtin_return is safe?

I tried looking at the RTL on x86/ppc/sparc targets, and the current 
support is obviously broken, and only works by accident some of the 
time.  So this is clearly needed, and does look like a reasonable 
solution to me.

The patch is OK.

We might also consider documenting that builtin_return is not safe for 
end users.  Likewise for all of the other builtin functions.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc-patches mailing list