http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60440

            Bug ID: 60440
           Summary: Bogus -Wreturn-type warning after error
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

In the following code snippet, the variable "b" is undeclared, so gcc reports
an error. But gcc also reports a warning "control reaches end of non-void
function". 
This should be bogus as there is a return statement at the end of the function. 

$: cat s.c 
int f(int a) {
  return a + b;
}
$: gcc-trunk -Wall -Wextra -c s.c 
s.c: In function ‘f’:
s.c:2:14: error: ‘b’ undeclared (first use in this function)
   return a + b;
              ^
s.c:2:14: note: each undeclared identifier is reported only once for each
function it appears in
s.c:3:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
$:

Reply via email to