erroneous "no return" warning on naked static function
Bug #1836547 reported by
Ling LI
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Arm Embedded Toolchain |
Fix Committed
|
Undecided
|
Richard Sandiford |
Bug Description
To be clear, it happens only to static naked functions; externs are not affected. Test case:
gcc version 7.3.1 20180622 (release) [ARM/embedded-
static int __attribute_
{
asm("bx lr");
}
And the message reads:
warning: no return statement in function returning non-void [-Wreturn-type]
A fake C return statement removes this warning, but may add dead code. More importantly, armclang doesn't allow return in naked functions, extern or static; it treats it as an error.
It might worth fixing for reduced annoyance and better consistency between static/extern and also gcc-arm/armclang.
To post a comment you must log in.
Again invalid, I don't see an easy route to fix this as the compiler cannot reason about code inside an inline assembler block.