This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[3.4/4.0 patch RFA] Fix PR 25613
- From: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- To: gcc-patches at gcc dot gnu dot org
- Cc: gdr at integrable-solutions dot net, joern dot rennecke at st dot com, aoliva at redhat dot com
- Date: Wed, 04 Jan 2006 23:17:09 +0900 (JST)
- Subject: [3.4/4.0 patch RFA] Fix PR 25613
Hi,
PR 25613 is an infinite loop problem on SH for the invalid asm
statements and a 3.4/4.0 regression from 3.0.
CONSTRAINT_LEN in config/sh/sh.h of 3.4/4.0 checks the wrong
constraints and returns -1 for them. This causes an infinite
loop in parse_input_constraint whick has a loop like:
for (j = 0; j < c_len; j += CONSTRAINT_LEN (constraint[j], constraint+j))
...
for the testcase in PR 25613. It seems that the above check
was a temporary one to confirm the use of constraints introduced
when some SH single character constraints were renamed to
multiple character constraints and that check was removed on
4.1/trunk but it's forgotten to remove on the 3.4/4.0 branches.
The attached patch is to remove the ckeck. It's tested with
bootstrap and the top level "make -k check" on 3.4 and 4.0
branches for sh4-unknown-linux-gnu with no new failures.
Ok for 3.4 and 4.0 branches?
Regards,
kaz
--
:ADDPATCH target:
2006-01-04 Kaz Kojima <kkojima@gcc.gnu.org>
PR target/25613
* config/sh/sh.h (CONSTRAINT_LEN): Use unchecking version.
diff -uprN ORIG/gcc-4.0/gcc/config/sh/sh.h LOCAL/gcc-4.0/gcc/config/sh/sh.h
--- ORIG/gcc-4.0/gcc/config/sh/sh.h 2004-12-30 12:08:06.000000000 +0900
+++ LOCAL/gcc-4.0/gcc/config/sh/sh.h 2006-01-02 13:41:32.000000000 +0900
@@ -1,6 +1,6 @@
/* Definitions of target machine for GNU compiler for Renesas / SuperH SH.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004 Free Software Foundation, Inc.
+ 2003, 2004, 2006 Free Software Foundation, Inc.
Contributed by Steve Chamberlain (sac@cygnus.com).
Improved by Jim Wilson (wilson@cygnus.com).
@@ -1619,30 +1619,11 @@ extern enum reg_class reg_class_from_let
unused CONST_INT constraint letters: LO
unused EXTRA_CONSTRAINT letters: D T U Y */
-#if 1 /* check that the transition went well. */
-#define CONSTRAINT_LEN(C,STR) \
- (((C) == 'L' || (C) == 'O' || (C) == 'D' || (C) == 'T' || (C) == 'U' \
- || (C) == 'Y' \
- || ((C) == 'I' \
- && (((STR)[1] != '0' && (STR)[1] != '1' && (STR)[1] != '2') \
- || (STR)[2] < '0' || (STR)[2] > '9')) \
- || ((C) == 'B' && ((STR)[1] != 's' || (STR)[2] != 'c')) \
- || ((C) == 'J' && ((STR)[1] != '1' || (STR)[2] != '6')) \
- || ((C) == 'K' && ((STR)[1] != '0' || (STR)[2] != '8')) \
- || ((C) == 'P' && ((STR)[1] != '2' || (STR)[2] != '7'))) \
- ? -1 \
- : ((C) == 'A' || (C) == 'B' || (C) == 'C' \
- || (C) == 'I' || (C) == 'J' || (C) == 'K' || (C) == 'P' \
- || (C) == 'R' || (C) == 'S') \
- ? 3 \
- : DEFAULT_CONSTRAINT_LEN ((C), (STR)))
-#else
#define CONSTRAINT_LEN(C,STR) \
(((C) == 'A' || (C) == 'B' || (C) == 'C' \
|| (C) == 'I' || (C) == 'J' || (C) == 'K' || (C) == 'P' \
|| (C) == 'R' || (C) == 'S') \
? 3 : DEFAULT_CONSTRAINT_LEN ((C), (STR)))
-#endif
/* The letters I, J, K, L and M in a register constraint string
can be used to stand for particular ranges of immediate operands.