This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] SH: Bootstrap failure


Hi,

Current mainline fails to build zlib on sh4-unknown-linux-gnu with

/exp/ldroot/dodes/xsh-gcc-orig/./gcc/xgcc -B/exp/ldroot/dodes/xsh-gcc-orig/./gcc/ -B/usr/local/sh4-unknown-linux-gnu/bin/ -B/usr/local/sh4-unknown-linux-gnu/lib/ -isystem /usr/local/sh4-unknown-linux-gnu/include -isystem /usr/local/sh4-unknown-linux-gnu/sys-include -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"zlib\" -DVERSION=\"1.1.4\" -DHAVE_MEMCPY=1 -DHAVE_STRERROR=1 -DHAVE_UNISTD_H=1 -I. -I../../../ORIG/gcc/zlib -O2 -g -O2 -c ../../../ORIG/gcc/zlib/gzio.c  -fPIC -DPIC -o .libs/gzio.o
../../../ORIG/gcc/zlib/gzio.c: In function 'gzprintf':
../../../ORIG/gcc/zlib/gzio.c:630: error: unrecognizable insn:
(insn 24 23 25 0 ../../../ORIG/gcc/zlib/gzio.c:600 (set (reg:SI 173)
        (plus:SI (reg/f:SI 154 virtual-stack-vars)
            (const_int 4116 [0x1014]))) -1 (nil)
    (nil))
../../../ORIG/gcc/zlib/gzio.c:630: internal compiler error: in extract_insn, at recog.c:2082

A smaller testcase is:

extern void bar ();

void
foo (const char *format, ...)
{
  char buf[4096];
  __builtin_va_list va;

  __builtin_va_start (va, format);
  bar (va);
  __builtin_va_end(va);
}

The above failure happened after applying the rth's patch

  http://gcc.gnu.org/ml/gcc-patches/2005-04/msg03041.html

It seems that instantiate_virtual_regs_in_insn calls extract_insn
for the insn like

  (set (reg:SI) (plus:SI (reg/f:SI  virtual-stack-vars)
			 (const_int 4116 [0x1014])))

in early stage of compilation and recog is failed because SHcompact
doesn't have the add immediate instruction with the constant larger
than 255.  The attached patch is a workaround for this problem,
though I'm not sure if it's the right thing.
The patch is tested with bootstrap and "make -k check" at toplevel
on sh4-unknown-linux-gnu with no new failures.

Regards,
	kaz
--
2005-05-03  Kaz Kojima  <kkojima@gcc.gnu.org>

	* config/sh/sh.md (*addsi3_compact): Use nonmemory_operand
	as the predicate for the second operand.

--- ORIG/gcc/gcc/config/sh/sh.md	2005-05-01 13:48:55.000000000 +0900
+++ LOCAL/gcc/gcc/config/sh/sh.md	2005-05-02 08:13:52.348290955 +0900
@@ -1007,10 +1007,14 @@
 	addi.l	%1, %2, %0"
   [(set_attr "type" "arith_media")])
 
+;; ??? The predicate for the second operand should be arith_operand,
+;; but it causes an ICE when the middle end attempts to recog the add
+;; immediate insn for wider constants.
+
 (define_insn "*addsi3_compact"
   [(set (match_operand:SI 0 "arith_reg_operand" "=r")
 	(plus:SI (match_operand:SI 1 "arith_operand" "%0")
-		 (match_operand:SI 2 "arith_operand" "rI08")))]
+		 (match_operand:SI 2 "nonmemory_operand" "rI08")))]
   "TARGET_SH1"
   "add	%2,%0"
   [(set_attr "type" "arith")])


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]