This is the mail archive of the gcc-bugs@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]

Re: x86: fixed or forbidden register spilled



  In message <199809061644.SAA04499@harpo.csd.uu.se>you write:
  > /* 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 GENE
  > RAL_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");
  > }
Your asm is buggy.

  You can not clobber a reg and also use it as an input or output.

  Your asm may also uses too many registers.

jeff



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