public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10175: -Wunreachable-code appears broken for one-line blocks.
@ 2003-03-21  0:36 bobsummerwill
  0 siblings, 0 replies; only message in thread
From: bobsummerwill @ 2003-03-21  0:36 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10175
>Category:       c++
>Synopsis:       -Wunreachable-code appears broken for one-line blocks.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 21 00:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Bob Summerwill, Electronic Arts, Inc.
>Release:        gcc version 3.2 (mingw special 20020817-1)
>Organization:
>Environment:
MinGW
>Description:
The -Wunreachable-code warning doesn't appear to work correctly for single-statement blocks.  I've replicate this behaviour on MinGW, Cygwin, and a colleague has verified it against the CVS head revision on Linux.
>How-To-Repeat:
Just compile the attached .ii file using MinGW-2.0.0.3, like so:

D:\>gcc -v
Reading specs from D:/FIFA/packages/MinGW/2.0.0.3/bin/../lib/gcc-lib/mingw32/3.2
/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=
mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable
-languages=f77,c++,objc,ada --disable-win32-registry --disable-shared
Thread model: win32
gcc version 3.2 (mingw special 20020817-1)

D:\>gcc -Wunreachable-code Unreachable.ii
Unreachable.cpp: In function `int main()':
Unreachable.cpp:12: warning: will never be executed

A warning is only issued for one the three unreachable statements.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="Unreachable.ii"
Content-Disposition: inline; filename="Unreachable.ii"

# 1 "Unreachable.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "Unreachable.cpp"
int main(void)
{
    int value = 0;

    if (0)
        value = 0;
    else
        value = 1;

    if (0) {
        value = 0;
        value = 0;
    } else {
        value = 1;
        value = 1;
    }

    return 0;
}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-21  0:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-21  0:36 c++/10175: -Wunreachable-code appears broken for one-line blocks bobsummerwill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).