PATCH: gas/2533: Internal error on immediate register operand

H. J. Lu hjl@lucon.org
Fri Apr 14 23:04:00 GMT 2006


We get
bad.s: Assembler messages:
bad.s:3: Internal error, aborting at /export/gnu/src/binutils-import/binutils/gas/config/tc-i386.c line 2123 in optimize_imm
Please report this bug.

on "movl $%ebx,%eax". This patch checks it.


H.J.
---
gas/

2006-04-14  H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/2533
	* config/tc-i386.c (i386_immediate): Check illegal immediate
	register operand.

gas/testsuite/

2006-04-14  H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/2533
	* gas/i386/inval.s: Add test for illegal immediate register
	operand.
	* gas/i386/inval.l: Updated.

--- gas/config/tc-i386.c.bad	2006-04-14 14:44:45.000000000 -0700
+++ gas/config/tc-i386.c	2006-04-14 15:34:12.000000000 -0700
@@ -4131,6 +4131,11 @@ i386_immediate (imm_start)
       return 0;
     }
 #endif
+  else if (!intel_syntax && exp->X_op == O_register)
+    {
+      as_bad (_("illegal immediate register operand %s"), imm_start);
+      return 0;
+    }
   else
     {
       /* This is an address.  The size of the address will be
--- gas/testsuite/gas/i386/inval.l.bad	1999-05-03 00:28:50.000000000 -0700
+++ gas/testsuite/gas/i386/inval.l	2006-04-14 15:40:05.000000000 -0700
@@ -45,6 +45,7 @@
 .*:46: Error: .*
 .*:47: Error: .*
 .*:48: Error: .*
+.*:49: Error: .*
 GAS LISTING .*
 
 
@@ -96,3 +97,4 @@ GAS LISTING .*
   46 [ 	]*	fstb	%st\(0\)
   47 [ 	]*	fcompll	28\(%ebp\)
   48 [ 	]*	fldlw	\(%eax\)
+  49 [ 	]*	movl	\$%ebx,%eax
--- gas/testsuite/gas/i386/inval.s.bad	1999-05-03 00:28:50.000000000 -0700
+++ gas/testsuite/gas/i386/inval.s	2006-04-14 15:40:00.000000000 -0700
@@ -46,3 +46,4 @@ foo:	jaw	foo
 	fstb	%st(0)
 	fcompll	28(%ebp)
 	fldlw	(%eax)
+	movl	$%ebx,%eax



More information about the Binutils mailing list