public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/7289: wrong code generated for switch statement
@ 2002-07-12 12:56 paterno
  0 siblings, 0 replies; 2+ messages in thread
From: paterno @ 2002-07-12 12:56 UTC (permalink / raw)
  To: gcc-gnats; +Cc: paterno


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c/7289: wrong code generated for switch statement
@ 2003-03-11 22:42 neroden
  0 siblings, 0 replies; 2+ messages in thread
From: neroden @ 2003-03-11 22:42 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, paterno, paterno

Synopsis: wrong code generated for switch statement

State-Changed-From-To: feedback->closed
State-Changed-By: neroden
State-Changed-When: Tue Mar 11 22:42:38 2003
State-Changed-Why:
    no feedback 3 mo

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7289


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-11 22:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-12 12:56 c/7289: wrong code generated for switch statement paterno
2003-03-11 22:42 neroden

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).