Bug 7335

Summary: Sparc: ICE in verify_wide_reg (flow.c:557) with long double and optimization
Product: gcc Reporter: wolfgang.bangerth
Component: rtl-optimizationAssignee: David S. Miller <davem>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs
Priority: P3    
Version: 3.1.1   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description wolfgang.bangerth 2002-07-17 02:26:03 UTC
gcc ICEs upon the following (simple, common) code when compiling with -O1 on sparc machines:
-------------------------------------------------
double* copy(long double* first, long double* last, double* result)
{
  int n;
  for (n = last - first; n > 0; --n) {
    *result = *first;
    ++first;
    ++result;
  }
  return result;
}

void f()
{
  long double *p1, *p2;
  double *p3;
  copy (p1, p2, p3);
  p3 = copy (p1, p2, p3);
};
----------------------------------------------------

deal.II/base> ~/bin/sparc-sun-solaris2.9/bin/gcc -v
Reading specs from /home/atlas2/wolf/bin/sparc-sun-solaris2.9/bin/../lib/gcc-lib/sparc-sun-solaris2.9/3.1.1/specs
Configured with: ../gcc-20020624/configure --prefix=/home/people/wolf/bin/sparc-sun-solaris2.9 --enable-languages=c,c++
Thread model: posix
gcc version 3.1.1 20020624 (prerelease)

deal.II/base> ~/bin/sparc-sun-solaris2.9/bin/gcc -O1 -c t.c
t.c: In function `copy':
t.c:10: Internal compiler error in verify_wide_reg, at flow.c:557
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Release:
gcc3.1, gcc3.1.1 pre of 20020624

Environment:
sparc-sun-solaris2.8/9
Comment 1 David S. Miller 2002-09-26 15:54:15 UTC
Responsible-Changed-From-To: unassigned->davem
Responsible-Changed-Why: Looking at it.
Comment 2 David S. Miller 2002-09-26 15:54:15 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Well first of all, you shouldn't be using long double since
    those types are not done in hardware on any Sparc processor.
    All of this is being done with calls to software emulation
    libraries.
    
    The bug itself seems to be a bad hoist being done by the
    loop pass, this corrupts the flow information which is
    what causes the crash.
Comment 3 David S. Miller 2002-09-26 21:18:00 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: See audit trail.
Comment 4 David S. Miller 2002-09-27 04:09:08 UTC
From: davem@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/7335
Date: 27 Sep 2002 04:09:08 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	davem@gcc.gnu.org	2002-09-26 21:09:08
 
 Modified files:
 	gcc            : ChangeLog calls.c 
 
 Log message:
 	2002-09-26  David S. Miller  <davem@redhat.com>
 	
 	PR optimization/7335
 	* calls.c (emit_library_call_value_1): Passing args by reference
 	converts a CONST function into a PURE one.
 
 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.56&r2=1.13152.2.657.2.57
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/calls.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.221.2.2.4.1&r2=1.221.2.2.4.2
 

Comment 5 David S. Miller 2002-09-27 04:12:51 UTC
From: davem@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/7335
Date: 27 Sep 2002 04:12:51 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	davem@gcc.gnu.org	2002-09-26 21:12:51
 
 Modified files:
 	gcc            : ChangeLog calls.c 
 
 Log message:
 	2002-09-26  David S. Miller  <davem@redhat.com>
 	
 	PR optimization/7335
 	* calls.c (emit_library_call_value_1): Passing args by reference
 	converts a CONST function into a PURE one.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.15556&r2=1.15557
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/calls.c.diff?cvsroot=gcc&r1=1.237&r2=1.238