From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18706 invoked by alias); 3 Dec 2002 22:16:03 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 18672 invoked by uid 71); 3 Dec 2002 22:16:01 -0000 Resent-Date: 3 Dec 2002 22:16:01 -0000 Resent-Message-ID: <20021203221601.18671.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, gisli.ottarsson@mscsoftware.com Received: (qmail 17592 invoked by uid 61); 3 Dec 2002 22:12:18 -0000 Message-Id: <20021203221218.17590.qmail@sources.redhat.com> Date: Tue, 03 Dec 2002 14:16:00 -0000 From: gisli.ottarsson@mscsoftware.com Reply-To: gisli.ottarsson@mscsoftware.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c/8804: gcc fails to warn when function omits a return statement X-SW-Source: 2002-12/txt/msg00171.txt.bz2 List-Id: >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: