From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29766 invoked by alias); 31 Dec 2001 18:16:04 -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 29691 invoked by uid 71); 31 Dec 2001 18:16:02 -0000 Resent-Date: 31 Dec 2001 18:16:02 -0000 Resent-Message-ID: <20011231181602.29689.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, thorpej@shagadelic.org Received:(qmail 29228 invoked from network); 31 Dec 2001 18:11:04 -0000 Received: from unknown (HELO dr-evil.shagadelic.org) (208.176.2.162) by sources.redhat.com with SMTP; 31 Dec 2001 18:11:04 -0000 Received: by dr-evil.shagadelic.org (Postfix, from userid 7518) id 4EEED9869; Mon, 31 Dec 2001 10:11:04 -0800 (PST) Message-Id:<20011231181104.4EEED9869@dr-evil.shagadelic.org> Date: Mon, 31 Dec 2001 10:16:00 -0000 From: thorpej@shagadelic.org To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:3.113 Subject: optimization/5230: Spurious warning compiling duffs device with optimization X-SW-Source: 2001-12/txt/msg01249.txt.bz2 List-Id: >Number: 5230 >Category: optimization >Synopsis: Spurious warning compiling duffs device with optimization >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Mon Dec 31 10:16:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Jason R. Thorpe >Release: 3.1 20011230 (experimental) >Organization: Wasabi Systems, Inc. >Environment: System: NetBSD dr-evil 1.5Z NetBSD 1.5Z (DR-EVIL) #252: Sun Dec 9 17:39:53 PST 2001 thorpej@dr-evil:/u1/netbsd/src/sys/arch/i386/compile/DR-EVIL i386 host: i386-unknown-netbsdelf build: i386-unknown-netbsdelf target: i386-unknown-netbsdelf configured with: ../../gcc/configure --disable-shared --prefix=/usr/local/gnu --host=i386-unknown-netbsdelf --target=i386-unknown-netbsdelf : (reconfigured) : (reconfigured) >Description: GCC produces a spurious warning when compiling a duffs device with optimization: dr-evil:thorpej 41$ i386-unknown-netbsdelf-gcc -S -O1 foo.c foo.c: In function `cksum': foo.c:13: warning: unreachable code at beginning of switch statement dr-evil:thorpej 42$ The resulting assembly code appears correct, and produces the expected result when given a test input. The warning does not appear if no optimization is used. >How-To-Repeat: The following C program will produce the warning when compiled with -O1. It will not produce a warning when compiled with -O0. In both cases, the generated assembly code is correct, and correct results are produced by the test inputs. begin 644 foo.c.gz M'XL("(6I,#P"`V9O;RYC`'70T6K",!3&\>NQ)L2,PVU M4=JH@^&[+U'!(NG=:?/[EYPZ'ZBMG>>"_HC8J7,^_/#"_IZL"78+.<7N&/"Y MW?AB"M/TYY9+(:H,U1FJ\G21H3I/99FQ\[Q5.;M,]D84+3W>Q`D^[TR@!;'KWAUL>OQ&*1"YJ7N+('O]:8IW$V\]4STZ.9'F;Z+5.CF1IFZBV3HYD<9O*5W8AU-IP[#VZ:^Q_[ )!]824U<;`@`` ` end >Fix: The warning can be avoided by not using optimization. >Release-Note: >Audit-Trail: >Unformatted: