This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/5897: No warning for statement after return
- From: yooden at vranx dot de
- To: gcc-gnats at gcc dot gnu dot org
- Date: 9 Mar 2002 12:13:10 -0000
- Subject: c/5897: No warning for statement after return
- Reply-to: yooden at vranx dot de
>Number: 5897
>Category: c
>Synopsis: No warning for statement after return
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Mar 09 04:16:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: yooden@vranx.de
>Release: 2.95.3, provided by SuSE 7.2
>Organization:
>Environment:
Linux eumel 2.4.4-4GB #1 Wed May 16 00:37:55 GMT 2001 i686 unknown
>Description:
In an if-else combo, statements after the returns are not reported when running:
gcc -O3 -Wall -pedantic
- - -
static int broken()
{
int i;
if (0)
{
return(1);
i = 0;
} else
{
return(1);
i = 0;
}
}
>How-To-Repeat:
gcc -O3 -Wall -pedantic -c broken.c -o broken.o
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="broken.i"
Content-Disposition: inline; filename="broken.i"
# 1 "broken.c"
static int broken()
{
int i;
if (0)
{
return(1);
i = 0;
} else
{
return(1);
i = 0;
}
}