public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: bobsummerwill@ea.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/10175: -Wunreachable-code appears broken for one-line blocks.
Date: Fri, 21 Mar 2003 00:36:00 -0000	[thread overview]
Message-ID: <20030321003206.27236.qmail@sources.redhat.com> (raw)


>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;
}


                 reply	other threads:[~2003-03-21  0:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030321003206.27236.qmail@sources.redhat.com \
    --to=bobsummerwill@ea.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).