This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/10175: -Wunreachable-code appears broken for one-line blocks.
- From: bobsummerwill at ea dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 21 Mar 2003 00:32:06 -0000
- Subject: c++/10175: -Wunreachable-code appears broken for one-line blocks.
- Reply-to: bobsummerwill at ea dot com
>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;
}