From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30902 invoked by alias); 21 Mar 2003 00:36:01 -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 30881 invoked by uid 71); 21 Mar 2003 00:36:00 -0000 Resent-Date: 21 Mar 2003 00:36:00 -0000 Resent-Message-ID: <20030321003600.30879.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, bobsummerwill@ea.com Received: (qmail 27237 invoked by uid 48); 21 Mar 2003 00:32:06 -0000 Message-Id: <20030321003206.27236.qmail@sources.redhat.com> Date: Fri, 21 Mar 2003 00:36:00 -0000 From: bobsummerwill@ea.com Reply-To: bobsummerwill@ea.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/10175: -Wunreachable-code appears broken for one-line blocks. X-SW-Source: 2003-03/txt/msg01359.txt.bz2 List-Id: >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 "" # 1 "" # 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; }