c/7153: bad operands for 'movsbl' error

Ben Liblit liblit@CS.Berkeley.EDU
Fri Jun 28 04:16:00 GMT 2002


>Number:         7153
>Category:       c
>Synopsis:       bad operands for 'movsbl' error
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 28 02:46:05 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Ben Liblit <liblit@cs.berkeley.edu>
>Release:        3.1
>Organization:
Computer Science Division, UC Berkeley
>Environment:
System: Linux brawnix.CS.Berkeley.EDU 2.4.18 #6 Wed Jun 12 02:01:38 PDT 2002 i686 unknown
Architecture: i686

host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.1/configure --prefix=/var/local/gcc/install
>Description:

When fed the C source file given below, gcc generates assembly code
which yields the following error message:

/var/tmp/ccKc5NSG.s:14: Error: suffix or operands invalid for `movsbl'

The assembly code on the line in question is:

	movsbl	%ebx,%eax

I don't know enough about x86 assembly code to know whether that is
correct (asm bug) or incorrect (gcc bug), but something somewhere is
broken.

Important note: the error only appears when compiling with
optimization level 2 or higher (-O2).  Below that, the code compiles
correctly.

Although I am reporting this as a bug in gcc-3.1, I have reproduced
the same problem in 2.96 and 3.0.

On the off chance that this is an assembler bug, I'm using
as-2.11.93.0.2.

>How-To-Repeat:

Compile the following code using "gcc -O2 -c bug.c":

	void f(char);
	void g();


	void scale()
	{
	  int width;
	  char bytes;
	  char *src;

	  if (width)
	    {
	      bytes = *src;
	      g();
	      width *= bytes;
	    }

	  f(bytes);
	}

I am aware that this code doesn't exactly do anything useful, and even
accesses uninitialized variables.  This fragment is a minimized
excerpt from the thousand-line source file in which I originally
encountered the bug.

>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list