This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/8804: gcc fails to warn when function omits a return statement
- From: gisli dot ottarsson at mscsoftware dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 3 Dec 2002 22:12:18 -0000
- Subject: c/8804: gcc fails to warn when function omits a return statement
- Reply-to: gisli dot ottarsson at mscsoftware dot com
>Number: 8804
>Category: c
>Synopsis: gcc fails to warn when function omits a return statement
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Dec 03 14:16:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Gisli Ottarsson
>Release: gcc (GCC) 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)
>Organization:
>Environment:
>Description:
The following program, which contains an int
function which fails to return a value, compiles
without a warning, even with the -pedantic flag.
The program illustrates a form of programmer brain-
damage where the programmer has neglected to type
the 'return' keyword. This bug can be extremely
difficult to find but many thankfully, many other
compilers will catch this and issue a warning/error.
For instance, SGI's compiler warns that: "Non-void
function "foo" (declared at line 1) should return a
value."
int foo()
{
3;
}
int main()
{
return foo();
}
Please modify gcc so that it issues a warning when it
encounters such mistakes.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: