This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

optimization/10239: m68k assembler error


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]