Bug 11420 - [3.3/3.4 regression][x86_64] gcc generates invalid asm code when "-O -fPIC" is used (suffix or operands invalid for `movabs')
Summary: [3.3/3.4 regression][x86_64] gcc generates invalid asm code when "-O -fPIC" i...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.3
: P2 normal
Target Milestone: 3.3.1
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-03 06:22 UTC by Aleksey Nogin
Modified: 2004-01-17 04:22 UTC (History)
2 users (show)

See Also:
Host: x86_64-redhat-linux
Target: x86_64-redhat-linux
Build: x86_64-redhat-linux
Known to work:
Known to fail:
Last reconfirmed: 2003-07-03 08:02:48


Attachments
A short example of a file that triggers the bug. (114 bytes, text/plain)
2003-07-03 06:23 UTC, Aleksey Nogin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aleksey Nogin 2003-07-03 06:22:40 UTC
Reproducible: 100%

To reproduce, run "gcc -O -fPIC -c bug.c" (I will attach a small self-contained
bug.c shortly).

Expected: it compiles (or produces an error message if the source is not a valid
C program).

Actual:

/tmp/ccMEmtFi.s: Assembler messages:
/tmp/ccMEmtFi.s:14: Error: suffix or operands invalid for `movabs'
Exit 1

This bug comes up when trying to compile OCaml (current CVS head) on x86_64
under a recent Red Hat Rawhide tree.

Note that both -O and -fPIC options are necessary to reproduce (without one or
both of them, the file compiles fine).

% gcc -v
Reading specs from /usr/lib/gcc-lib/x86_64-redhat-linux/3.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--host=x86_64-redhat-linux
Thread model: posix
gcc version 3.3 20030623 (Red Hat Linux 3.3-12)

I also reported this to Red Hat - see
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=98518
Comment 1 Aleksey Nogin 2003-07-03 06:23:37 UTC
Created attachment 4335 [details]
A short example of a file that triggers the bug.
Comment 2 Andreas Jaeger 2003-07-03 07:09:04 UTC
Confirmed with 3.3 and 3.4 CVS, works with 3.2:
byrd:~/tmp:[1]$ /opt/gcc/3.2-devel/bin/gcc -c t.c -fPIC -O
byrd:~/tmp:[0]$ /opt/gcc/3.3-devel/bin/gcc -c t.c -fPIC -O
/tmp/ccoET0CJ.s: Assembler messages:
/tmp/ccoET0CJ.s:14: Error: suffix or operands invalid for `movabs'
byrd:~/tmp:[1]$ /opt/gcc/3.4-devel/bin/gcc -c t.c -fPIC -O
/tmp/ccHxgLYq.s: Assembler messages:
/tmp/ccHxgLYq.s:14: Error: suffix or operands invalid for `movabs'
Comment 3 CVS Commits 2003-07-08 18:01:55 UTC
Subject: Bug 11420

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jakub@gcc.gnu.org	2003-07-08 18:01:51

Modified files:
	gcc            : ChangeLog 
	gcc/testsuite  : ChangeLog 
	gcc/config/i386: i386.md i386.c i386-protos.h 
Added files:
	gcc/testsuite/gcc.dg: 20030708-1.c 

Log message:
	PR c/11420
	* config/i386/i386.c (ix86_check_movabs): New function.
	* config/i386/i386-protos.h (ix86_check_movabs): New prototype.
	* config/i386/i386.md (movabs[shqd]i_1_rex64): Kill broken alternative.
	(movabs[shqd]i_[12]_rex64): Add ix86_check_movabs check to conditions.
	
	* gcc.dg/20030708-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.399&r2=2.400
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2851&r2=1.2852
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&r1=1.476&r2=1.477
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.586&r2=1.587
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386-protos.h.diff?cvsroot=gcc&r1=1.99&r2=1.100
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/20030708-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 4 CVS Commits 2003-07-08 19:16:48 UTC
Subject: Bug 11420

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	jakub@gcc.gnu.org	2003-07-08 19:16:45

Modified files:
	gcc            : ChangeLog 
	gcc/testsuite  : ChangeLog 
	gcc/config/i386: i386.md i386.c i386-protos.h 
Added files:
	gcc/testsuite/gcc.dg: 20030708-1.c 

Log message:
	PR c/11420
	* config/i386/i386.c (ix86_check_movabs): New function.
	* config/i386/i386-protos.h (ix86_check_movabs): New prototype.
	* config/i386/i386.md (movabs[shqd]i_1_rex64): Kill broken alternative.
	(movabs[shqd]i_[12]_rex64): Add ix86_check_movabs check to conditions.
	
	* config/i386/i386.md (movdi_1_rex64): Set Y<-m alternative's type
	to ssemov.
	
	PR c/11420
	* gcc.dg/20030707-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.640&r2=1.16114.2.641
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.222&r2=1.2261.2.223
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.404.2.18&r2=1.404.2.19
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.495.2.22&r2=1.495.2.23
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386-protos.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.86.2.1&r2=1.86.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/20030708-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1

Comment 5 CVS Commits 2003-07-08 19:22:11 UTC
Subject: Bug 11420

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_2-rhl8-branch
Changes by:	jakub@gcc.gnu.org	2003-07-08 19:22:06

Modified files:
	gcc            : ChangeLog 
	gcc/testsuite  : ChangeLog 
	gcc/config/i386: i386.md i386.c i386-protos.h 
Added files:
	gcc/testsuite/gcc.dg: 20030708-1.c 

Log message:
	PR c/11420
	* config/i386/i386.c (ix86_check_movabs): New function.
	* config/i386/i386-protos.h (ix86_check_movabs): New prototype.
	* config/i386/i386.md (movabs[shq]i_1_rex64): Kill broken alternative.
	(movabs[shqd]i_[12]_rex64): Add ix86_check_movabs check to conditions.
	
	* config/i386/i386.md (movdi_1_rex64): Set Y<-m alternative's type
	to sse.
	
	PR c/11420
	* gcc.dg/20030707-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.13152.2.657.2.27.2.130&r2=1.13152.2.657.2.27.2.131
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.1672.2.166.2.8.2.51&r2=1.1672.2.166.2.8.2.52
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.339.2.13.2.1.2.17&r2=1.339.2.13.2.1.2.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.368.2.19.2.2.2.27&r2=1.368.2.19.2.2.2.28
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386-protos.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.68.2.3.4.5&r2=1.68.2.3.4.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/20030708-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=NONE&r2=1.1.6.1

Comment 6 Andrew Pinski 2003-07-09 01:44:57 UTC
Jakub Jelinek, your patch fixes this bug, right?
Comment 7 Andrew Pinski 2003-07-11 14:53:44 UTC
Closing as fixed on the mainline and 3.3.1 from the above patches.