This is the mail archive of the gcc@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: return statement in a function with the naked attribute


On May 3, 2013, at 00:15, reed kotler <rkotler@mips.com> wrote:

> There was some confusion on the llvm list because some tests were run on targets that did not support the naked attribute.
> 
> I think we are thinking now that the return statement should not be emitted unless explicitly requested.
> 
> It's not totally clear in the gcc manual so that is why I was asking.

I clearly is an error to have a function that doesn't return.
So, what you really asking is: "What are the semantics of a (naked)
functon that doesn't return?"

I think it would make sense for a compiler to emit a special error-return
(such as abort()) at the end of such a function, with the expectation that
this code usually would be unreachable and optimized away.

I don't think it makes sense to try and define any other semantics
for a funciotn that doesn't explicitly return a value. 

  -Geert

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