Bug 7594 - [3.3 regression] [m68k] ICE on legal code associated with simplify-rtx
Summary: [3.3 regression] [m68k] ICE on legal code associated with simplify-rtx
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.2
: P2 critical
Target Milestone: 3.3.1
Assignee: Richard Henderson
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2002-08-14 04:36 UTC by rz
Modified: 2003-06-12 21:57 UTC (History)
5 users (show)

See Also:
Host: m68k-linux
Target: m68k-linux
Build: m68k-linux
Known to work:
Known to fail:
Last reconfirmed: 2003-06-12 21:50:39


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rz 2002-08-14 04:36:01 UTC
following testcase triggers ICE:

#### compile with -O0 to trigger ICE ####

extern void (**table)(void);

typedef unsigned short uw16;
typedef unsigned short uw16;
typedef unsigned int gshort;

register uw16 *pc asm("%a4");
register gshort code asm("%d6");


void QMExecuteLoop(uw16 *oldPC)
{
            table[code=(*(uw16*)(pc++))]();
}

########################################

Problem is caused by gen_lowpart() returning a REG instead of an
SUBREG expression in certain cases. This is caused by some code
in simplify_subreg around lines 2644 in simplify-rtx.c

Release:
3.2 20020806 (prerelease) and 3.1.1

Environment:
native and crosscompiled
configured with: ../gcc-3.2-cvs/configure --enable-languages=c --disable-checking --with-newlib --without-headers --target=m68k-linux : (reconfigured) ../gcc-3.2-cvs/configure --enable-languages=c --disable-checking --with-newlib --without-headers --target=m68k-linux
Comment 1 rz 2002-08-14 04:36:01 UTC
Fix:
Workaround for m68k-linux is to disable the code responsible
for this simplification:

--- gcc-3.2-cvs/gcc/simplify-rtx.c.rz   Wed Mar  6 23:43:21 2002
+++ gcc-3.2-cvs/gcc/simplify-rtx.c      Wed Aug 14 13:09:30 2002
@@ -2618,6 +2618,7 @@
      suppress this simplification.  If the hard register is the stack,
      frame, or argument pointer, leave this as a SUBREG.  */
 
+#if 0
   if (REG_P (op)
       && (! REG_FUNCTION_VALUE_P (op)
          || ! rtx_equal_function_value_matters)
@@ -2662,6 +2663,7 @@
          return x;
        }
     }
+#endif
 
   /* If we have a SUBREG of a register that we are replacing and we are
      replacing it with a MEM, make a new MEM and try replacing the
Comment 2 Dara Hazeghi 2003-05-09 16:34:25 UTC
From: Dara Hazeghi <dhazeghi@yahoo.com>
To: gcc-gnats@gcc.gnu.org, rz@linux-m68k.org
Cc: law@redhat.com
Subject: Re: middle-end/7594: [m68k] ICE on legal code associated with simplify-rtx
Date: Fri, 9 May 2003 16:34:25 -0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- 
 trail&database=gcc&pr=7594
 
 Hello,
 
 I can confirm that this bug is still present on 3.2 and 3.3 branch but  
 does not occur on mainline (20030508) gcc cross compiler. Jeff Law,  
 you're listed as m68k maintainer. Would there be any interest in fixing  
 this in the 3.3 branch after 3.3.0? Thanks,
 
 Dara
 
Comment 3 Giovanni Bajo 2003-05-10 07:24:36 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed to be still present in the 3.3 branch
Comment 4 rz 2003-05-11 22:37:46 UTC
From: Richard Zidlicky <rz@linux-m68k.org>
To: Dara Hazeghi <dhazeghi@yahoo.com>
Cc: gcc-gnats@gcc.gnu.org, law@redhat.com
Subject: Re: middle-end/7594: [m68k] ICE on legal code associated with simplify-rtx
Date: Sun, 11 May 2003 22:37:46 +0200

 On Fri, May 09, 2003 at 04:34:25PM -0700, Dara Hazeghi wrote:
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- 
 > trail&database=gcc&pr=7594
 
 Hi,
 
 > I can confirm that this bug is still present on 3.2 and 3.3 branch but  
 > does not occur on mainline (20030508) gcc cross compiler. Jeff Law,  
 > you're listed as m68k maintainer. Would there be any interest in fixing  
 > this in the 3.3 branch after 3.3.0? Thanks,
 
 thanks for looking at it. The bug is pretty severe, not only did it
 break glibc but even medium sized packages won´t compile without a fix.
 I would certainly be very interested to know if my patch is correct.
 
 Richard
Comment 5 Dara Hazeghi 2003-06-04 01:01:12 UTC
Richard,

sorry to see there's been no progress on this. The patch you referenced is just to disable the 
transformation, correct? Thanks,

Dara
Comment 6 CVS Commits 2003-06-12 21:57:05 UTC
Subject: Bug 7594

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	rth@gcc.gnu.org	2003-06-12 21:56:59

Modified files:
	gcc            : ChangeLog 
	gcc/config/m68k: m68k.md 

Log message:
	PR target/7594
	* config/m68k/m68k.md (zero_extendhisi2): Use gen_lowpart_SUBREG.
	(zero_extendqihi2, zero_extendqisi2): Likewise.

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.573&r2=1.16114.2.574
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/m68k/m68k.md.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.51.14.3&r2=1.51.14.4

Comment 7 CVS Commits 2003-06-12 21:57:36 UTC
Subject: Bug 7594

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2003-06-12 21:57:31

Modified files:
	gcc            : ChangeLog 
	gcc/config/m68k: m68k.md 

Log message:
	PR target/7594
	* config/m68k/m68k.md (zero_extendhisi2): Use gen_lowpart_SUBREG.
	(zero_extendqihi2, zero_extendqisi2): Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.18177&r2=1.18178
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/m68k/m68k.md.diff?cvsroot=gcc&r1=1.58&r2=1.59

Comment 8 Richard Henderson 2003-06-12 21:57:59 UTC
http://gcc.gnu.org/ml/gcc-patches/2003-06/msg01349.html