public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: gni@gecko.de
To: gcc-gnats@gcc.gnu.org
Subject: optimization/10239: m68k assembler error
Date: Thu, 27 Mar 2003 10:56:00 -0000	[thread overview]
Message-ID: <200303271033.h2RAX4Ux062896@lorien.int.gecko.de> (raw)


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


                 reply	other threads:[~2003-03-27 10:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200303271033.h2RAX4Ux062896@lorien.int.gecko.de \
    --to=gni@gecko.de \
    --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).