public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21191] New: Bogus "control may reach end of non-void function" warning in inlined function
@ 2005-04-24 15:20 mattias at virtutech dot se
2005-04-24 15:23 ` [Bug c/21191] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: mattias at virtutech dot se @ 2005-04-24 15:20 UTC (permalink / raw)
To: gcc-bugs
Inlined functions can give rise to bogus warnings when they contain statically
determined branches. Testcase:
static inline int f(int x) { if (1) return 17; }
int h(int z) { return f(z); }
foo$ gcc -O2 -Wall -c foo.c
foo.c: In function 'h':
foo.c:2: warning: control may reach end of non-void function 'f' being inlined
This kind of code is not uncommon, nor bad style, and makes -Werror useless.
This is a regression from gcc 3.4.0.
The same warning is given with:
static inline int f(int x, int q) { if (q) return 17; }
int h(int z) { return f(z, 1); }
--
Summary: Bogus "control may reach end of non-void function"
warning in inlined function
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mattias at virtutech dot se
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21191
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/21191] Bogus "control may reach end of non-void function" warning in inlined function
2005-04-24 15:20 [Bug c/21191] New: Bogus "control may reach end of non-void function" warning in inlined function mattias at virtutech dot se
@ 2005-04-24 15:23 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-24 15:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-24 15:23 -------
*** This bug has been marked as a duplicate of 19699 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21191
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-04-24 15:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-24 15:20 [Bug c/21191] New: Bogus "control may reach end of non-void function" warning in inlined function mattias at virtutech dot se
2005-04-24 15:23 ` [Bug c/21191] " pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).