This is the mail archive of the gcc-bugs@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]

optimization/7829: GCC 3.1, 3.2 and 3.2.1-pre ICE with -march=athlon + PATCH


>Number:         7829
>Category:       optimization
>Synopsis:       -march=athlon causes GCC3 to fail with ICE
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 04 14:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Alexander N. Kabaev
>Release:        3.2 [FreeBSD]
>Organization:
>Environment:
System: FreeBSD ork.gte.com 4.6-STABLE FreeBSD 4.6-STABLE #1: Mon Aug 12 12:13:55 EDT 2002 root@ork.gte.com:/usr/src/sys/compile/KAN i386


	
host: i386-portbld-freebsd4.6
build: i386-portbld-freebsd4.6
target: i386-portbld-freebsd4.6
configured with: ./..//gcc-3.2/configure --disable-nls --with-gnu-as --with-gnu-ld --with-gxx-include-dir=/usr/local/lib/gcc-lib/i386-portbld-freebsd4.6/3.2/include/g++ --disable-shared --prefix=/usr/local i386-portbld-freebsd4.6
>Description:
	The sample code below causes GCC versions 3.1.1, 3.2 and the one built
        from the top of gcc-3_2-branch to die with message:

$ gcc32 -O -march=athlon -c bad.c
bad.c: In function `gbkext1_mbtowc':
bad.c:5: unrecognizable insn:
(insn 55 53 57 (set (reg:QI 68)
        (const_int 128 [0x80])) -1 (nil)
    (nil))
bad.c:5: Internal compiler error in extract_insn, at recog.c:2148
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

0x80 is not a valid representation for 128 in QImode. It should
be 0xffffff80 (i.e. sign extended) for insn to be recognized.
 
The proposed one-line patch seems to fix the problem.
   
>How-To-Repeat:

static unsigned int
gbkext1_mbtowc (unsigned char c1, unsigned char c2)
{
  return  c1 + (c2 - (c2 >= 0x80 ? 0x41 : 0x40));
}

>Fix:

Index: loop.c
===================================================================
RCS file: /usr/ncvs/src/contrib/gcc/loop.c,v
retrieving revision 1.1.1.13
diff -u -r1.1.1.13 loop.c
--- loop.c	1 Sep 2002 20:37:48 -0000	1.1.1.13
+++ loop.c	4 Sep 2002 14:28:06 -0000
@@ -9278,7 +9278,8 @@
 
 	case LEU:
 	  if (uconst_val < max_val)
-	    code = LTU, op1 = GEN_INT (uconst_val + 1);
+	    code = LTU, op1 = GEN_INT (
+	      trunc_int_for_mode (uconst_val + 1, GET_MODE (op0)));
 	  break;
 
 	case GEU:
>Release-Note:
>Audit-Trail:
>Unformatted:


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