Bug 18932 - [3.4/4.0 regression] ICE in copyprop_hardreg_forward_1, at regrename.c
Summary: [3.4/4.0 regression] ICE in copyprop_hardreg_forward_1, at regrename.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.4
: P2 critical
Target Milestone: 3.3.6
Assignee: Richard Henderson
URL:
Keywords: ice-on-valid-code
: 19057 19593 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-12-10 20:21 UTC by H.J. Lu
Modified: 2005-10-24 01:39 UTC (History)
3 users (show)

See Also:
Host:
Target: i686-pc-linux-gnu
Build:
Known to work: 3.4.3 3.4.4 4.0.0
Known to fail:
Last reconfirmed: 2004-12-12 19:20:28


Attachments
A testcase (81.88 KB, text/plain)
2004-12-10 20:23 UTC, H.J. Lu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2004-12-10 20:21:21 UTC
This patch

http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00701.html

causes a regression on i386.
Comment 1 H.J. Lu 2004-12-10 20:23:19 UTC
Created attachment 7721 [details]
A testcase

I got

[hjl@gnu-10 tmp]$ /usr/gcc-3.4/bin/gcc -O2 -march=pentium4  -S ~/foo.c
/export/home/hjl/foo.c: In function `amd74xx_ide_dma_check':
/export/home/hjl/foo.c:16297: error: insn does not satisfy its constraints:
(insn 106 48 50 1 (parallel [
	    (set (reg:CCNO 17 flags)
		(compare:CCNO (and:QI (reg/v:QI 4 si [orig:66 speed ] [66])
			(const_int -16 [0xfffffff0]))
		    (const_int 0 [0x0])))
	    (set (reg/v:QI 4 si [orig:66 speed ] [66])
		(and:QI (reg/v:QI 4 si [orig:66 speed ] [66])
		    (const_int -16 [0xfffffff0])))
	]) 205 {*andqi_2} (nil)
    (expr_list:REG_UNUSED (reg/v:QI 4 si [orig:66 speed ] [66])
	(nil)))
/export/home/hjl/foo.c:16297: internal compiler error: in
copyprop_hardreg_forward_1, at regrename.c:1549
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 2 Richard Henderson 2004-12-10 20:25:38 UTC
Do not assign prs to people unless they request it.  Assignment implies
actively working on the problem.  Use cc for advisory.
Comment 3 Serge Belyshev 2004-12-10 21:06:02 UTC
// small testcase:

int bar (int p, char c)
{
 foo (p, c);
 if (c & 0xF0)
  return p;
}
Comment 4 Serge Belyshev 2004-12-12 19:20:28 UTC
testcase for 4.0.0, use "-O2" to reproduce:
----------------------------------------------------------------------------------------
char m[2];
char o[2];
short i[2];
int t[2];

void foo ()
{
  int c;
  
  for (c = 0; c < 2; c++)
    {
      if (i[c & 0xff] & 4)
	o[0] = 0;
      else if (i[c & 0xff] & 128)
	{
	  m[c] = t[c & 0xff];
	  o[c] = c;
	}
      
      if ((i[c & 0xff] & 136) || (i[c & 0xff] & 4))
	o[0] = 0;
    }
}
----------------------------------------------------------------------------------------
/usr/local/libexec/gcc/i686-pc-linux-gnu/4.0.0/cc1 -quiet tc-i386.c -O2
tc-i386.c: In function ‘foo’:
tc-i386.c:25: error: insn does not satisfy its constraints:
(insn 166 96 98 5 (parallel [
            (set (reg:CCNO 17 flags)
                (compare:CCNO (and:QI (reg:QI 4 si [orig:107 D.1127 ] [107])
                        (const_int -120 [0xffffff88]))
                    (const_int 0 [0x0])))
            (set (reg:QI 4 si [orig:107 D.1127 ] [107])
                (and:QI (reg:QI 4 si [orig:107 D.1127 ] [107])
                    (const_int -120 [0xffffff88])))
        ]) 207 {*andqi_2} (nil)
    (expr_list:REG_UNUSED (reg:QI 4 si [orig:107 D.1127 ] [107])
        (nil)))
tc-i386.c:25: internal compiler error: in copyprop_hardreg_forward_1, at
regrename.c:1567
Comment 5 CVS Commits 2004-12-12 20:57:38 UTC
Subject: Bug 18932

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2004-12-12 20:57:28

Modified files:
	gcc            : ChangeLog 
	gcc/config/i386: i386.md predicates.md 

Log message:
	PR target/18932
	* config/i386/i386.md (all splits and peepholes): Use flags_reg_operand
	and compare_operator to propagate the input CC mode to the output.
	* config/i386/predicates.md (compare_operator): New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6792&r2=2.6793
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&r1=1.570&r2=1.571
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/predicates.md.diff?cvsroot=gcc&r1=1.6&r2=1.7

Comment 6 CVS Commits 2004-12-12 20:59:30 UTC
Subject: Bug 18932

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	rth@gcc.gnu.org	2004-12-12 20:59:24

Modified files:
	gcc            : ChangeLog 
	gcc/config/i386: i386-protos.h i386.c i386.h i386.md 

Log message:
	PR target/18932
	* config/i386/i386.md (all splits and peepholes): Use flags_reg_operand
	and compare_operator to propagate the input CC mode to the output.
	* config/i386/i386.c (compare_operator): New.
	* config/i386/i386.h (PREDICATE_CODES): Add it.
	* config/i386/i386-protos.h: Update.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.727&r2=2.2326.2.728
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386-protos.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.104.4.2&r2=1.104.4.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.635.2.15&r2=1.635.2.16
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.368.2.5&r2=1.368.2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.502.2.9&r2=1.502.2.10

Comment 7 CVS Commits 2004-12-12 21:00:53 UTC
Subject: Bug 18932

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	rth@gcc.gnu.org	2004-12-12 21:00:49

Modified files:
	gcc            : ChangeLog 
	gcc/config/i386: i386-protos.h i386.c i386.h i386.md 

Log message:
	PR target/18932
	* config/i386/i386.md (all splits and peepholes): Use flags_reg_operand
	and compare_operator to propagate the input CC mode to the output.
	* config/i386/i386.c (flags_reg_operand, compare_operator): New.
	* config/i386/i386.h (PREDICATE_CODES): Add them.
	* config/i386/i386-protos.h: Update.

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.1037&r2=1.16114.2.1038
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386-protos.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.86.2.2&r2=1.86.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.495.2.36&r2=1.495.2.37
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.309.2.11&r2=1.309.2.12
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.404.2.26&r2=1.404.2.27

Comment 8 Richard Henderson 2004-12-12 21:07:48 UTC
Fixed.
Comment 9 Andrew Pinski 2004-12-17 15:32:13 UTC
*** Bug 19057 has been marked as a duplicate of this bug. ***
Comment 10 Andrew Pinski 2005-10-24 01:39:08 UTC
*** Bug 19593 has been marked as a duplicate of this bug. ***