User account creation filtered due to spam.

Bug 10067 - GCC-3.2.2 outputs invalid asm on sparc64
Summary: GCC-3.2.2 outputs invalid asm on sparc64
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.2.2
: P3 normal
Target Milestone: ---
Assignee: Eric Botcazou
URL:
Keywords:
: 9108 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-03-13 23:46 UTC by dat94ali
Modified: 2003-07-25 17:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
mallocr.i (4.11 KB, text/x-c)
2003-05-21 15:17 UTC, dat94ali
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dat94ali 2003-03-13 23:46:00 UTC
When building a generic cross-compiler from sparc to sparc64 
(using GNU make and native gcc 3.2.2 for the build), the resulting
"xgcc" will output assembly operands in incorrect order, making 
GNU as stop on error. GCC will output branch-with-prediction
instructions like "ba,pt,a %xcc LABEL" which is invalid. The correct
order is "ba,a,pt %xcc LABEL". This did not happen with GCC 3.2.1 so
it is some kind of regression. The error does not occur while building a native gcc-3.2.2 on sparc64 NetBSD-1.5ZC
configured with --enable-languages=c,c++ and similarly
configured binutils 2.13.2.1


Binutils and GCC were both configured with:
"--target=sparc64-elf --program-prefix=sparc64- --enable-languages=c,c++"
and newlib-1.11.0 was linked into the gcc tree for automatic building, with
NetBSD startup files (crt*.o) in /usr/local/sparc64/lib to make configure
scripts that try to test whether xgcc works by attempting to link something
happy.

The errors occurred while trying to build newlib/libc/stdlib/
A transcript of the failing session follows:

-----8<-----------8<-----------8<-----------8<-----------8<------
Reading specs from /usr/tmp/gcc-3.2.2/work/gcc/specs
Configured with: ../configure --prefix=/usr/local/sparc64 --enable-languages=c,c++ --target=sparc64-elf --program-prefix=sparc64-
Thread model: single
gcc version 3.2.2
 /usr/tmp/gcc-3.2.2/work/gcc/cpp0 -lang-c -nostdinc -v -I. -I../../../../../newlib/libc/stdlib -iprefix /usr/tmp/gcc-3.2.2/work/gcc/../lib/gcc-lib/sparc64-elf/3.2.2/ -isystem /usr/tmp/gcc-3.2.2/work/gcc/include -isystem /usr/tmp/gcc-3.2.2/work/sparc64-elf/newlib/include -isystem /usr/local/sparc64/sparc64-elf/bin/include -isystem /usr/local/sparc64/sparc64-elf/lib/include -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102 -Dsparc -D__ELF__ -D__sparc__ -D__ELF__ -D__sparc -Acpu=sparc -Amachine=sparc -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -D__supersparc__ -D__sparc_v8__ -D__arch64__ -Acpu=sparc64 -Amachine=sparc64 -D__svr4__ -DPACKAGE="newlib" -DVERSION="1.11.0" -DMALLOC_ALIGNMENT=8 -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_BLKSIZE -DHAVE_GETTIMEOFDAY -DHAVE_FCNTL -DTARGET_PTR_SIZE=64 -DINTERNAL_NEWLIB -DDEFINE_MALLOPT -isystem /usr/tmp/gcc-3.2.2/work/sparc64-elf/newlib/targ-include -isystem /usr/tmp/gcc-3.2.2/newlib/libc/include -isystem /usr/local/sparc64/sparc64-elf/include ../../../../../newlib/libc/stdlib/mallocr.c mallocr.i
ignoring nonexistent directory "/usr/tmp/gcc-3.2.2/work/sparc64-elf/newlib/include"
ignoring nonexistent directory "/usr/local/sparc64/sparc64-elf/bin/include"
ignoring nonexistent directory "/usr/local/sparc64/sparc64-elf/lib/include"
ignoring nonexistent directory "/usr/local/sparc64/sparc64-elf/include"
GNU CPP version 3.2.2 (cpplib) (sparc64-elf)
#include "..." search starts here:
#include <...> search starts here:
 .
 ../../../../../newlib/libc/stdlib
 /usr/tmp/gcc-3.2.2/work/gcc/include
 /usr/tmp/gcc-3.2.2/work/sparc64-elf/newlib/targ-include
 /usr/tmp/gcc-3.2.2/newlib/libc/include
End of search list.
 /usr/tmp/gcc-3.2.2/work/gcc/cc1 -fpreprocessed mallocr.i -quiet -dumpbase mallocr.c -mcpu=supersparc -mtune=supersparc -O2 -O2 -O2 -version -fno-builtin -o mallocr.s
GNU CPP version 3.2.2 (cpplib) (sparc64-elf)
GNU C version 3.2.2 (sparc64-elf)
 compiled by GNU C version 3.2.2.
 /usr/local/sparc64/sparc64-elf/bin/as -V -s -64 -no-undeclared-regs -o malloptr.o mallocr.s
GNU assembler version 2.13.2.1 (sparc64-elf) using BFD version 2.13.2.1
mallocr.s: Assembler messages:
mallocr.s:24: Error: Illegal operands
mallocr.s:43: Error: Illegal operands
-----8<-----------8<-----------8<-----------8<-----------8<------

Release:
gcc-3.2.2

Environment:
sparc-unknown-netbsdelf16
gcc 3.2.2
binutils 2.13.2.1

How-To-Repeat:
Configure and try to build a sparc->sparc64 cross compiler,
and compile any C source leading to the emission of branch
with prediction instructions with the "annul" bit set, such
as newlib-1.11.0/newlib/libc/stdlib/mallocr.c (preprocessed source included)
Comment 1 dat94ali 2003-03-13 23:46:00 UTC
Fix:
Correct order of emission of attributes to branch instructions with predictions; The ",a" modifier ("annul" bit) should always appear first (sections A.3 - A.7
of the SPARCv9 architecture manual).
Comment 2 Eric Botcazou 2003-03-27 09:10:43 UTC
Responsible-Changed-From-To: unassigned->ebotcazou
Responsible-Changed-Why: Fixing.
Comment 3 Eric Botcazou 2003-03-27 09:10:43 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed with gcc 3.2.1 and gcc 3.2.2
Comment 4 Eric Botcazou 2003-03-28 09:10:43 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: target/10067
Date: 28 Mar 2003 09:10:43 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	ebotcazou@gcc.gnu.org	2003-03-28 09:10:43
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/config/sparc: sparc.md 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.dg: ultrasp8.c 
 
 Log message:
 	PR target/10067
 	* config/sparc/sparc.md (jump pattern): Correct order
 	when issuing the annuling marker.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.17237&r2=1.17238
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.md.diff?cvsroot=gcc&r1=1.183&r2=1.184
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2552&r2=1.2553
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/ultrasp8.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 5 Eric Botcazou 2003-03-28 09:18:01 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: target/10067
Date: 28 Mar 2003 09:18:01 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	ebotcazou@gcc.gnu.org	2003-03-28 09:18:00
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/config/sparc: sparc.md 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.dg: ultrasp8.c 
 
 Log message:
 	PR target/10067
 	* config/sparc/sparc.md (jump pattern): Correct order
 	when issuing the annuling marker.
 
 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.373&r2=1.16114.2.374
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.md.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.181.4.2&r2=1.181.4.3
 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.128&r2=1.2261.2.129
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/ultrasp8.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
 

Comment 7 Eric Botcazou 2003-03-28 09:27:32 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed. See http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02306.html