public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: paterno@fnal.gov
To: gcc-gnats@gcc.gnu.org
Cc: paterno@fnal.gov;, jbk@fnal.gov
Subject: c/7289: wrong code generated for switch statement
Date: Fri, 12 Jul 2002 12:56:00 -0000	[thread overview]
Message-ID: <20020712195412.16021.qmail@sources.redhat.com> (raw)


>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:


             reply	other threads:[~2002-07-12 19:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-12 12:56 paterno [this message]
2003-03-11 22:42 neroden

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020712195412.16021.qmail@sources.redhat.com \
    --to=paterno@fnal.gov \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).