Bug 28911

Summary: Cross compiler build for m68k--elf fails on x86_64-linux-gnu
Product: gcc Reporter: Luke Powell <luke.powell>
Component: targetAssignee: Kazu Hirata <kazu>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, jens, kazu, luke.powell, tobutaz, zdenekjs
Priority: P3 Keywords: patch
Version: 4.1.1   
Target Milestone: 4.2.0   
URL: http://gcc.gnu.org/ml/gcc-patches/2006-09/msg01028.html
Host: x86_64-linux-gnu Target: m68k-unknown-elf
Build: x86_64-linux-gnu Known to work:
Known to fail: Last reconfirmed: 2006-09-01 18:38:32

Description Luke Powell 2006-08-30 21:34:02 UTC
+++ This bug was initially created as a clone of Bug #23442 +++

Attempting to build a cross-compiler for m68k-unknown-elf on x86_64-linux-gnu
fails with an internal error:
/home/lpowell/build-gcc/./gcc/xgcc -B/home/lpowell/build-gcc/./gcc/
-B/home/lpowell/m68k-gcc/m68k-elf/bin/ -B/home/lpowell/m68k-gcc/m68k-elf/lib/
-isystem /home/lpowell/m68k-gcc/m68k-elf/include -isystem
/home/lpowell/m68k-gcc/m68k-elf/sys-include -O2  -O2 -g -O2  -DIN_GCC
-DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition  -isystem ./include   -g 
-DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I.
-I../../gcc-4.1.1/gcc -I../../gcc-4.1.1/gcc/. -I../../gcc-4.1.1/gcc/../include
-I../../gcc-4.1.1/gcc/../libcpp/include  -m68000 -DL_fixdfdi -c
../../gcc-4.1.1/gcc/libgcc2.c -o libgcc/m68000/_fixdfdi.o
../../gcc-4.1.1/gcc/libgcc2.c: In function ‘__fixdfdi’:
../../gcc-4.1.1/gcc/libgcc2.c:1238: internal compiler error: in do_SUBST, at
combine.c:470

The host compiler is gcc version 4.1.0 

The configure command was
../gcc-4.1.1/configure --target=m68k-elf --prefix=/home/lpowell/m68k-gcc
--disable-shared --with-gnu-as --with-gnu-ld --with-newlib --without-headers
--enable-languages=c --with-local-prefix=/home/lpowell/m68k-gcc/m68k-elf
Comment 1 Andrew Pinski 2006-08-30 21:38:16 UTC
Yes try the mainline for the cross compiler.

*** This bug has been marked as a duplicate of 23442 ***
Comment 2 Luke Powell 2006-08-30 21:46:16 UTC
I'm not familiar with that term, mainline. Is that the current CVS snapshot or something else? Thanks.
Comment 3 Andrew Pinski 2006-08-31 02:58:26 UTC
(In reply to comment #2)
> I'm not familiar with that term, mainline. Is that the current CVS snapshot or
> something else? Thanks.

It is the SVN trunk, so a svn snapshot will be a snapshot of the mainline.
Comment 4 Luke Powell 2006-08-31 21:59:46 UTC
(In reply to comment #3)
> It is the SVN trunk, so a svn snapshot will be a snapshot of the mainline.
> 
I attempted a rebuild with the trunk at SVN revision 116602. The compilation did get past the previous bug building __fixdfdi.o, but an almost identical bug occurred later:
/home/lpowell/build-gcc/./gcc/xgcc -B/home/lpowell/build-gcc/./gcc/ -B/home/lpowell/m68k/m68k-elf/bin/ -B/home/lpowell/m68k/m68k-elf/lib/ -isystem /home/lpowell/m68k/m68k-elf/include -isystem /home/lpowell/m68k/m68k-elf/sys-include -O2  -O2 -g -O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I/home/lpowell/gcc-trunk/gcc/gcc -I/home/lpowell/gcc-trunk/gcc/gcc/. -I/home/lpowell/gcc-trunk/gcc/gcc/../include -I/home/lpowell/gcc-trunk/gcc/gcc/../libcpp/include  -I/home/lpowell/gcc-trunk/gcc/gcc/../libdecnumber -I../libdecnumber -m68000 -DL_mulsc3 -c /home/lpowell/gcc-trunk/gcc/gcc/libgcc2.c -o libgcc/m68000/_mulsc3.o
/home/lpowell/gcc-trunk/gcc/gcc/libgcc2.c: In function ‘__mulsc3’:
/home/lpowell/gcc-trunk/gcc/gcc/libgcc2.c:1854: internal compiler error: in do_SUBST, at combine.c:496

This error occurs at the same assertion in combine.c as the previous bug.
Comment 5 Kazu Hirata 2006-09-01 18:38:32 UTC
Reproduced.
Comment 6 Kazu Hirata 2006-09-01 19:17:50 UTC
Reduced down to:

/* m68k-none-elf-gcc -O2 -m68000 */

_Complex float
foo (float a)
{
  return __builtin_copysign (a != a, a);
}
Comment 7 Kazu Hirata 2006-09-24 06:41:21 UTC
This is because of GEN_INT (0x80000000) is used in SImode.
Searching for "GEN_INT (0x80000000)" in m68k.md reveals three such uses.
Comment 8 Kazu Hirata 2006-09-24 18:47:34 UTC
Subject: Bug 28911

Author: kazu
Date: Sun Sep 24 18:47:25 2006
New Revision: 117181

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117181
Log:
gcc/
	PR target/28911
	* config/m68k/m68k.md (negsf2, negdf2, negxf2): Use
	-2147483647 - 1 instead of 0x80000000.

gcc/testsuite/
	PR target/28911
	* gcc.dg/pr28911.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/pr28911.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/m68k/m68k.md
    trunk/gcc/testsuite/ChangeLog

Comment 9 Kazu Hirata 2006-09-24 18:48:12 UTC
Just checked in a patch.
Comment 10 Andreas Schwab 2007-03-27 16:36:28 UTC
*** Bug 31324 has been marked as a duplicate of this bug. ***