Bug 31756

Summary: g++ internal compiler error in change_stack when compiling -O2
Product: [Retired] Red Hat Linux Reporter: Jean-Francois Panisset <panisset>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-03-14 16:26:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jean-Francois Panisset 2001-03-13 23:17:39 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76C-SGI [en] (X11; I; IRIX64 6.5 IP30)


Try compiling the included test program with gcc-c++-2.96-69 on x86 with
-O2, you will
get an internal compiler error:

$ g++ -c -O2 sqrt.C 
sqrt.C: In function `float process_pixel (X)':
sqrt.C:12: Internal compiler error in change_stack, at reg-stack.c:2214
Please submit a full bug report.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.



Reproducible: Always
Steps to Reproduce:
Here is the test program:

__inline float sqrtf (float __x) 
{
  register float __result;
  __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x));
  return __result; 
}

class X
{
public:
  X();
  virtual ~X() {}
};

class Y
{
public:
  Y();
  bool foo();
};

float
process_pixel(X x)
{
  Y y;
  if ( !y.foo() )
    return 1.0;
  return 28.0f * sqrtf(28.0);
}
	

Actual Results:  g++ internal compiler error (only with -O2, with -g, it
compiles fine).


Expected Results:  g++ shouldn't die.

The __inline definition of sqrtf() comes from math.h

Comment 1 Jakub Jelinek 2001-03-14 16:26:54 UTC
I have fixed this in my tree, am just bootstrapping CVS gcc with it before
submitting it to gcc-patches. It will appear later on in gcc-2.96-79.