[Bug target/11775] "Control reaches end" warning issued for __attribute__((naked)) functions

pgonzalez at bluel dot com gcc-bugzilla@gcc.gnu.org
Mon Aug 25 18:58:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11775



------- Additional Comments From pgonzalez at bluel dot com  2003-08-25 18:58 -------
> To silence that warning, wouldn't using __attribute__((noreturn) 
> make sense? 

The example I gave above returns the value "1" by moving it into
the ARM register r0.  Maybe I don't fully understand the intent
of the "naked" feature.  Since the prologue/epilogue code involves
setting up the stack frame (which requires knowledge of how
the compiler is allocating local variables etc), it seems that
the most common usage would be cases where the entire function 
body is written in inline assembler.  I am using it this way,
to allow hand-coding of functions generated by C++ macros (which
would be difficult to code directly in assembler).

If there are valid cases where "naked" functions would rely on
the compiler-generated code to return values (which it sounds
like you are saying), then I agree that the warning should not 
be disabled by "naked".  However, there should be some way to 
disable this warning for an individual function.  Maybe this 
can be merged with bug 9049.



More information about the Gcc-bugs mailing list