From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20254 invoked by alias); 12 Jul 2002 19:56:02 -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 20185 invoked by uid 71); 12 Jul 2002 19:56:01 -0000 Resent-Date: 12 Jul 2002 19:56:01 -0000 Resent-Message-ID: <20020712195601.20184.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, paterno@fnal.gov;, jbk@fnal.gov Resent-Reply-To: gcc-gnats@gcc.gnu.org, paterno@fnal.gov Received: (qmail 16022 invoked by uid 61); 12 Jul 2002 19:54:12 -0000 Message-Id: <20020712195412.16021.qmail@sources.redhat.com> Date: Fri, 12 Jul 2002 12:56:00 -0000 From: paterno@fnal.gov Reply-To: paterno@fnal.gov To: gcc-gnats@gcc.gnu.org Cc: paterno@fnal.gov;, jbk@fnal.gov X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) X-GNATS-Notify: paterno@fnal.gov; jbk@fnal.gov Subject: c/7289: wrong code generated for switch statement X-SW-Source: 2002-07/txt/msg00391.txt.bz2 List-Id: >Number: 7289 >Category: c >Synopsis: wrong code generated for switch statement >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Fri Jul 12 12:56:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Marc Paterno >Release: gcc version 3.1 >Organization: >Environment: gcc -v Reading specs from /home/cdfsoft/products/gcc/v3_1/Linux+2/lib/gcc-lib/i686-pc-l inux-gnu/3.1/specs Configured with: ../../gcc-3.1/configure --prefix=/tmp/build-gcc-v3_1 --disable- shared --with-gnu-ld --with-ld=/tmp/build-gcc-v3_1/bin/ld --with-gnu-as --with-a s=/tmp/build-gcc-v3_1/bin/as --enable-threads=posix Thread model: posix gcc version 3.1 >Description: The generated object file contains an unresolved symbol which should not exist. The symbol is generated because of the mishandling of a assembler statement label. The problem only appears when all these conditions are met: 1) optimization level is -O0 2) the enum has at least 5 elements 3) all non-default branches of the switch return the same value 4) the default branch of the switchs either returns the same value OR is known not to return (either it calls a function marked as "noreturn", or, in C++, it throws). >How-To-Repeat: Compile with gcc -O0 -c bad.i >Fix: If any level of optimization greater than 0 is used, the problem does not appear. If the default statement calls a function which the compiler can't tell will not return, the problem does not appear. >Release-Note: >Audit-Trail: >Unformatted: