Bug 53782

Summary: missing return value causes no warning in inlined functions
Product: [Retired] Red Hat Linux Reporter: David Nečas <yeti>
Component: gcc3Assignee: Jakub Jelinek <jakub>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-02 00:07:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Nečas 2001-09-18 15:26:54 UTC
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:

   Always.


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-02 00:07:14 UTC
Still a problem.  Upstream gcc bugzilla for this is
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13000