Bug 8396 - [3.2/3.3/3.4 regression] [sparc] optimizer ICE
Summary: [3.2/3.3/3.4 regression] [sparc] optimizer ICE
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: 3.1.x/3.2.x
Assignee: Eric Botcazou
URL:
Keywords: ice-on-valid-code
: 9123 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-10-30 00:36 UTC by papadopo
Modified: 2004-08-25 17:31 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.2.3 3.4.0
Known to fail: 3.2.2
Last reconfirmed:


Attachments
didispfn.i (90.88 KB, text/x-c)
2003-05-21 15:17 UTC, papadopo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description papadopo 2002-10-30 00:36:01 UTC
Hi,

I'm attempting to build the DICOM Toolkit using GCC 3.2 + GNU binutils 2.12.1 on SPARC / Solaris 8. I get this error:

c++     -DHAVE_CONFIG_H  -DNDEBUG  -c -I. -I. -I../include -I../../config/include -I../../ofstd/include -I../../dcmdata/include  \
         -O -I/usr/local/tiff/include -I/usr/local/openssl/include -D_REENTRANT -Wall -pedantic didispfn.cc 
../include/dicrvfit.h: In member function `int 
   DiDisplayFunction::interpolateValues()':
../include/dicrvfit.h:164: Internal compiler error in copy_to_mode_reg, at 
   explow.c:711
Please submit a full bug report,
with preprocessed source if appropriate.

This is an optimizer bug, removing the "-O" option flag fixes the bug.

I can work around the problem by changing the relevant code from:
        if (... && (xs < xe))
to:
        if (... && (xe > xs))

Note: I haven't tried removing useless stuff from the preprocessed file because I thought it wouldn't help in this particular case. I can try to build a minimal test case if that's important.

Release:
gcc-3.2

How-To-Repeat:
Compile the attached preprocessed file:
c++ -c -O didispfn.i
Comment 1 papadopo 2002-10-30 10:09:27 UTC
From: Dimitri Papadopoulos <papadopo@REMOVE.shfj.DECOY.cea.fr>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   papadopo@shfj.REMOVE.cea.DECOY.fr.cea.fr, gcc-bugs@gcc.gnu.org
Cc:  
Subject: Re: optimization/8396: optimizer ICE on SPARC
Date: Wed, 30 Oct 2002 10:09:27 +0100

 This is a multi-part message in MIME format.
 --------------060007050009070405090207
 Content-Type: text/plain; charset=us-ascii; format=flowed
 Content-Transfer-Encoding: 7bit
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8396
 
 Attached is a much shorter example that reproduces the bug.
 
 --------------060007050009070405090207
 Content-Type: text/plain;
  name="didispfn.cc"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="didispfn.cc"
 
 template <typename T1>
 struct Foo
 {
     static void bar(const T1 xs, const T1 xe)
     {
         void *a;
 	void *b;
 	void *c;
         if (a && b && c && (xs < xe))
             ;
     }
 };
 
 
 int main()
 {
     short xe;
     Foo<short>::bar(0, xe);
 }
 
 --------------060007050009070405090207--
 
Comment 2 Christian Ehrhardt 2002-12-20 06:49:25 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed with 3.2 and 3.4, it is a regression from 2.95.
    An even simpler testcase is this:
    
    ---------------------------- cut ---------------------------
    struct Foo {
    	static void bar(const short xs, const short xe) {
    		if (xe && (xs < xe ))
    			;
    	}
    };
     
    int main()
    {   
    	short xe;
    	Foo::bar(0, xe);
    }
    ---------------------------- cut ---------------------------
    
    It ICEs in explow.c:731 in this function because GET_MODE(x) == HImode:
    
    rtx
    copy_to_mode_reg (mode, x)
         enum machine_mode mode;
         rtx x;
    { 
      rtx temp = gen_reg_rtx (mode);
    
      /* If not an operand, must be an address with PLUS and MULT so
         do the computation.  */
      if (! general_operand (x, VOIDmode))
        x = force_operand (x, temp);
    
      if (GET_MODE (x) != mode && GET_MODE (x) != VOIDmode)
        abort ();
      if (x != temp)
        emit_move_insn (temp, x);
      return temp;
    }
    
         regards   Christian
Comment 3 Eric Botcazou 2003-03-11 13:54:23 UTC
Responsible-Changed-From-To: unassigned->ebotcazou
Responsible-Changed-Why: Investigating.
Comment 4 Eric Botcazou 2003-03-14 14:49:40 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/8396
Date: 14 Mar 2003 14:49:40 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	ebotcazou@gcc.gnu.org	2003-03-14 14:49:40
 
 Modified files:
 	gcc            : ChangeLog tree-inline.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.c-torture/compile: 20030314-1.c 
 
 Log message:
 	PR optimization/8396
 	* tree-inline.c (initialize_inlined_parameters): Make sure the value
 	of read-only constant arguments is passed with the right type.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.17078&r2=1.17079
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-inline.c.diff?cvsroot=gcc&r1=1.50&r2=1.51
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2505&r2=1.2506
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/20030314-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 5 Eric Botcazou 2003-03-14 14:53:57 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/8396
Date: 14 Mar 2003 14:53:57 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	ebotcazou@gcc.gnu.org	2003-03-14 14:53:57
 
 Modified files:
 	gcc            : ChangeLog tree-inline.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.c-torture/compile: 20030314-1.c 
 
 Log message:
 	PR optimization/8396
 	* tree-inline.c (initialize_inlined_parameters): Make sure the value
 	of read-only constant arguments is passed with the right type.
 
 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.298&r2=1.16114.2.299
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-inline.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.38.2.4&r2=1.38.2.5
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.98&r2=1.2261.2.99
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/20030314-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
 

Comment 6 Eric Botcazou 2003-03-14 14:59:35 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/8396
Date: 14 Mar 2003 14:59:35 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	ebotcazou@gcc.gnu.org	2003-03-14 14:59:35
 
 Modified files:
 	gcc            : ChangeLog tree-inline.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.c-torture/compile: 20030314-1.c 
 
 Log message:
 	PR optimization/8396
 	* tree-inline.c (initialize_inlined_parameters): Make sure the value
 	of read-only constant arguments is passed with the right type.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.13152.2.657.2.259&r2=1.13152.2.657.2.260
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-inline.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.15.2.3.4.2&r2=1.15.2.3.4.3
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.108&r2=1.1672.2.166.2.109
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/20030314-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.4.1
 
Comment 7 Eric Botcazou 2003-03-14 15:07:37 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed. See http://gcc.gnu.org/ml/gcc-patches/2003-03/msg01134.html
Comment 8 Andrew Pinski 2004-08-25 17:29:53 UTC
*** Bug 9123 has been marked as a duplicate of this bug. ***