From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29067 invoked by alias); 30 Nov 2005 15:52:59 -0000 Received: (qmail 29055 invoked by uid 48); 30 Nov 2005 15:52:57 -0000 Date: Wed, 30 Nov 2005 15:52:00 -0000 Subject: [Bug c++/25181] New: wrong "will never be executed" warning in switch - case block X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "oliverst at online dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2005-11/txt/msg04106.txt.bz2 List-Id: The following code will report this: C:\Dev-Cpp\Projects\test-stlport\main_18.cpp In function `int test_18()': 13 C:\Dev-Cpp\Projects\test-stlport\main_18.cpp [Warning] will never be executed extern int abort(); int test_18() { int type; switch (type) { case 1: int ret = abort(); if (ret != 0) return 2; break; case 3: break; default: return 1; } return 0; } If you remove "case 3" or "default" the warning will go away. I already reported something similar under bug 24968. C:\MinGW_3.4.4\bin>gcc -v Reading specs from ../lib/gcc/mingw32/3.4.4/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=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --e nable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-ja va-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchroniz ation --enable-libstdcxx-debug Thread model: win32 gcc version 3.4.4 (mingw special) -- Summary: wrong "will never be executed" warning in switch - case block Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: oliverst at online dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25181