public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/10239: m68k assembler error
@ 2003-03-27 10:56 gni
0 siblings, 0 replies; only message in thread
From: gni @ 2003-03-27 10:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 10239
>Category: optimization
>Synopsis: switch jumptable causes assembler error on m68k
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Mar 27 10:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Gunther Nikl
>Release: 3.3 20030303 (prerelease)
>Organization:
>Environment:
host: i386-unknown-freebsd4.8
build: i386-unknown-freebsd4.8
target: m68k-unknown-linux-gnu
configured with: ../gcc-20030303/configure --target=m68k-linux
>Description:
The compiler emits unused and incomplete switch jump-tables when compiling
with -O1 which cause assembler errors.
>How-To-Repeat:
The testcase was extracted from ra-colorize.c.
$ cat x.c
enum node_type
{
INITIAL = 0, FREE,
PRECOLORED,
SIMPLIFY, SIMPLIFY_SPILL, SIMPLIFY_FAT, FREEZE, SPILL,
SELECT,
SPILLED, COALESCED, COLORED,
LAST_NODE_TYPE
};
inline void
put_web (enum node_type type)
{
switch (type)
{
case INITIAL:
case FREE:
case FREEZE:
case SPILL:
foo();
break;
case PRECOLORED:
bar();
break;
default:
baz ();
}
}
void
reset_lists ()
{
put_web (INITIAL);
}
$ ./xgcc -B./ -O -S x.c -o -
.file "x.c"
.text
.align 2
.globl reset_lists
.type reset_lists, @function
reset_lists:
link.w %a6,#0
jbra .L6
.align 2
.L9:
.word .L6-.L9
.word .L6-.L9
.word .L7-.L9
.word .L8-.L9
.word .L8-.L9
.word .L8-.L9
.word .L6-.L9
.word .L6-.L9
.align 2
.L6:
jbsr foo
unlk %a6
rts
.size reset_lists, .-reset_lists
.ident "GCC: (GNU) 3.3 20030303 (prerelease)"
$
The jumptable references labels that aren't emitted (L7,L8,L9) thus gas
barfs. Since the table is unused it shouldn't be emitted.
>Fix:
Compiling with -fgcse added (or with -O2 which enables it by default)
$ ./xgcc -B./ -O -fgcse -S x.c -o -
.file "x.c"
.text
.align 2
.globl reset_lists
.type reset_lists, @function
reset_lists:
link.w %a6,#0
jbsr foo
unlk %a6
rts
.size reset_lists, .-reset_lists
.ident "GCC: (GNU) 3.3 20030303 (prerelease)"
$
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-03-27 10:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-27 10:56 optimization/10239: m68k assembler error gni
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).