Bug 53782 - missing return value causes no warning in inlined functions
missing return value causes no warning in inlined functions
Product: Red Hat Linux
Classification: Retired
Component: gcc3 (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2001-09-18 11:26 EDT by David Nečas
Modified: 2007-04-18 12:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-01 20:07:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description David Nečas 2001-09-18 11:26:54 EDT
Description of Problem:  When one forgets to return a return value in
inline function and the function is successfully inlined, compiler
generates no warning about missing return value.  (Of course, this can be
avoided by compliling without optimization, when no (even inline) functions
are actually inlined.)

Version-Release number of selected component (if applicable):

   Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.0.1/specs
   Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix --disa
ble-checking --host=i386-redhat-linux
   Thread model: posix
   gcc version 3.0.1 20010724 (Red Hat Linux 7.1 3.0-5) 

How Reproducible:


Steps to Reproduce:
1. create a file (let's call it inlinewarn.c) with following content:

   static inline int foo(void) { }
   int main(void) { foo(); return 0; }
2. compile it

   $ gcc3 -Wall -O -c inlinewarn.c

Actual Results:

   It compiles without warnings.

Expected Results:

   gcc prints the same warning as without -O (and compiles it):
   inlinewarn.c: In function `foo':
   inlinewarn.c:1: warning: control reaches end of non-void function

Additional Information:

   gcc 2.95 prints the warning no matter whether optimizing or not.
Comment 1 Richard Henderson 2004-10-01 20:07:14 EDT
Still a problem.  Upstream gcc bugzilla for this is

Note You need to log in before you can comment on or make changes to this bug.