Bugzilla – Bug 78554
misleading warning of gcc 4.0
Last modified: 2008-06-25 09:49:28 UTC
Compiling this little example gives confusing warnings: int test () { return; return 1; } return.c: In function ‘test’: return.c:4: warning: ‘return’ with no value, in function returning non-void return.c:6: warning: control reaches end of non-void function The first warning is ok but the second is simply stupid and misleading.
I think this is perfectly fine. Given that the optimizer will probably discard and not analyze _any code anymore_ after the "return;", you're practically left with what could be equal to: int test() { return; } BTW, do you use -O, -O2 or any higher for your testcase?
That's why Arvin agrees that the first warning is okay. And the second warning "control reaches end of non-void function" in a way just repeats the first one, and ergo is useless. Anyway, this is nothing to fix locally in SuSE GCC, so it will come in with some later update to GCC 4.1.
mass reopening all SuSE Linux bugs that are set to REMIND+LATER to change the resolution to WONTFIX (adapting to new policy)
Closing old LATER+REMIND bugs as WONTFIX - if you still plan to work on it, feel free to reopen and set to ASSIGNED. In case the report saw repeated reopen comments, it's due to bugzilla timing out on the huge request ;(