Subject: port-mac68k/5496: Non-optimized compile dies on inline assembly.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <hauke@Espresso.Rhein-Neckar.DE>
List: netbsd-bugs
Date: 05/25/1998 21:04:28
>Number: 5496
>Category: port-mac68k
>Synopsis: Non-optimized compile dies on inline assembly.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: gnats-admin (GNATS administrator)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon May 25 12:35:01 1998
>Last-Modified:
>Originator: hauke@Espresso.Rhein-Neckar.DE
>Organization:
Einzeln auftretender Radfahrer
>Release: NetBSD 1.3E sources of 980520
>Environment:
System: NetBSD q700.hf.org 1.3B NetBSD 1.3B (FG54) #4: Sun Jan 25 22:02:13 CET 1998 hauke@q700:/usr/src/sys/arch/mac68k/compile/FG54 mac68k
>Description:
A kernel compile without optimization chokes on "mac68k/mac68k/macrom.c" with
cc -pipe -m68020-40 -ffreestanding -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-main -msoft-float -I. -I../../../../arch -I../../../.. -nostdinc -DHZ="0x3c" -DM68040 -DFPSP -DFPU_EMULATE -DSYSVMSG -DSYSVSEM -DSYSVSHM -DSHMMAXPGS="0x400" -DLKM -DBUFPAGES="0x3e8" -DKTRACE -DDDB -DDDB_HISTORY_SIZE="0x32" -DDIAGNOSTIC -DDEBUG -DCOMPAT_43 -DCOMPAT_10 -DCOMPAT_11 -DCOMPAT_12 -DCOMPAT_13 -DNFSSERVER -DFIFO -DINET -DNETATALK -DMAXUSERS=16 -D_KERNEL -Dmc68020 -Dmac68k -c ../../../../arch/mac68k/mac68k/macrom.c
../../../../arch/mac68k/mac68k/macrom.c: In function `mrg_aline_super':
../../../../arch/mac68k/mac68k/macrom.c:760: fixed or forbidden register was spilled.
This may be due to a compiler bug or to impossible asm
statements or clauses.
cpp: output pipe has been closed
*** Error code 1
Stop.
This happens with 1.3.1 sources, too. Compiler is a -current egcs, the
offending code is
/*
* Handle a supervisor mode A-line trap.
*/
void
mrg_aline_super(struct frame *frame)
{
caddr_t trapaddr;
u_short trapword;
int isOStrap;
int trapnum;
int a0passback;
u_int32_t a0bucket, d0bucket;
int danprint=0; /* This shouldn't be necessary, but seems to be. */
#if defined(MRG_DEBUG)
printf("mrg: a super");
#endif
trapword = *(u_short *)frame->f_pc;
if (trapword == 0xa71e)
danprint = 1;
#if defined(MRG_DEBUG)
printf(" wd 0x%lx", (long)trapword);
#endif
isOStrap = ! TRAP_TOOLBOX(trapword);
trapnum = TRAP_NUM(trapword);
if (danprint) {
/*
* Without these print statements, ADBReInit fails on IIsi
* It is unclear why--perhaps a compiler bug? delay()s do not
* work, nor does some assembly similar to the printf calls.
* A printf(""); is sufficient, but gcc -Wall is noisy about
* it, so I figured backspace is harmless enough...
*/
printf("\010"); printf("\010");
}
#if defined(MRG_DEBUG)
printf(" %s # 0x%x", isOStrap? "OS" :
"ToolBox", trapnum);
#endif
/* Only OS Traps come to us; _alinetrap takes care of ToolBox
traps, which are a horrible Frankenstein-esque abomination. */
trapaddr = mrg_OStraps[trapnum];
#if defined(MRG_DEBUG)
printf(" addr 0x%lx\n", (long)trapaddr);
printf(" got: d0 = 0x%8x, a0 = 0x%8x, called from: 0x%8x\n",
frame->f_regs[0], frame->f_regs[8], frame->f_pc );
#endif
if (trapaddr == NULL) {
printf("unknown %s trap 0x%x, no trap address available\n",
isOStrap ? "OS" : "ToolBox", trapword);
panic("mrg_aline_super()");
}
a0passback = TRAP_PASSA0(trapword);
#if defined(MRG_TRACE)
tron();
#endif
/* put a0 in a0 */
/* put a1 in a1 */
/* put d0 in d0 */
/* put d1 in d1 */
/* put trapaddr in a2 */
/* save a6 */
/* call the damn routine */
/* restore a6 */
/* store d0 in d0bucket */
/* store a0 in d0bucket */
/* This will change a2,a1,d1,d0,a0 and possibly a6 */
asm("
movl %2, d0
movl %3, d1
movl %4, a0
movl %5, a1
movl %6, a2
jbsr a2@
movl a0, %0
movl d0, %1"
: "=g" (a0bucket), "=g" (d0bucket)
: "m" (frame->f_regs[0]), "m" (frame->f_regs[1]),
"m" (frame->f_regs[8]), "m" (frame->f_regs[9]),
"g" (trapaddr)
: "d0", "d1", "a0", "a1", "a2", "a6"
);
#if defined(MRG_TRACE)
troff();
#endif
#if defined(MRG_DEBUG)
printf(" result: d0 = 0x%8x, a0 = 0x%8x\n",
d0bucket, a0bucket );
printf(" bk");
#endif
frame->f_regs[0] = d0bucket;
if (a0passback)
frame->f_regs[8] = a0bucket;
frame->f_pc += 2; /* skip offending instruction */
#if defined(MRG_DEBUG)
printf(" exit\n");
#endif
}
>How-To-Repeat:
Build a kernel with
makeoptions COPTS="-m68020-40 -pipe -ffreestanding"
or similar, i.e. without optimization options.
>Fix:
None.
>Audit-Trail:
>Unformatted: