[Bug c/30794] New: -Wreturn-type acts differently at -O3
ian at airs dot com
gcc-bugzilla@gcc.gnu.org
Wed Feb 14 18:26:00 GMT 2007
Compile this simple file with -Wreturn-type -O2:
void *foo () { while (1) ; }
There is no warning. Then compiler it with -Wreturn-type -O3. I get
foo.c:1: warning: no return statement in function returning non-void
This happens because the test for -Wreturn-type in finish_function checks for
DECL_INLINE. At -O3 all functions have DECL_INLINE set. This applies to the
C++ frontend as well.
It's not obvious to me that this particular warning should change depending on
the optimization level. And it's really not obvious that we get the warning at
-O3 and not at -O0, -O1, or -O2.
The same issue arises in both the C and the C++ frontends.
One simple fix might be to check DECL_DECLARED_INLINE_P instead of DECL_INLINE.
--
Summary: -Wreturn-type acts differently at -O3
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ian at airs dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30794
More information about the Gcc-bugs
mailing list