Bug 53782 - missing return value causes no warning in inlined functions
Summary: missing return value causes no warning in inlined functions
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc3
Version: 9
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-09-18 15:26 UTC by David Nečas
Modified: 2007-04-18 16:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-10-02 00:07:14 UTC
Embargoed:


Attachments (Terms of Use)

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



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