x86: fixed or forbidden register spilled

Mikael Pettersson mikpe@csd.uu.se
Sun Sep 6 09:44:00 GMT 1998


/* bug.c -- extracted from Linux kernel 2.1.120 drivers/char/apm_bios.c
 * compile with: gcc -c bug.c [-O0 or -O makes no difference]
 *
 * Both gcc-2.8.1 and gcc-2.7.2.3 on the Intel x86 die with:
 *
 *	bug.c: In function `apm_bios_call':
 *	bug.c:31: fixed or forbidden register was spilled.
 *	This may be due to a compiler bug or to impossible asm
 *	statements or clauses.
 *
 * egcs-1.1a on the Intel x86 dies with:
 *
 *	bug.c: In function `apm_bios_call':
 *	bug.c:31: fixed or forbidden register 7 (sp) was spilled for class GENERAL_REGS.
 *	This may be due to a compiler bug or to impossible asm
 *	statements or clauses.
 */

typedef unsigned int u32;

void apm_bios_call(u32 eax_in, u32 ebx_in, u32 ecx_in,
	u32 *eax, u32 *ebx, u32 *ecx, u32 *edx, u32 *esi)
{
	int	error;

	__asm__("nop"
		:  "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx),
		   "=S" (*esi), "=D" (error)
		: "a" (eax_in), "b" (ebx_in), "c" (ecx_in), "r" (0)
		: "ax", "bx", "cx", "dx", "si", "di", "bp", "memory");
}



More information about the Gcc-bugs mailing list