This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

-fpic confuses scheduler


Hi,

the appended testcase derived from glibc aborts on powerpc-linux-gnu if 
compiled with "-O2 -fpic". Removing -fpic or adding -fno-schedule-insns fixes 
it. This causes a glibc-2.1.94 testsuite failure.

OK to commit the testcase?

Franz.

/* { dg-do run { target rs6000-*-linux* powerpc-*-linux* powerpc-*-eabi* } } */
/* { dg-options "-O2 -fpic" } */

extern void abort (void);
extern void exit(int);

typedef signed int int32_t;
typedef unsigned int u_int32_t;

typedef union
{
  double value;
  struct
  {
    u_int32_t msw;
    u_int32_t lsw;
  } parts;
} ieee_double_shape_type;

static const double
  zero = 0.00000000000000000000e+00,
  one = 1.00000000000000000000e+00,
  minus_one = -1.00000000000000000000e+00,
  two = 2.00000000000000000000e+00,
  pio4 = 7.85398163397448278999e-01,
  pio4lo= 3.06161699786838301793e-17,
  T[] = {
     3.33333333333334091986e-01,
     1.33333333333201242699e-01,
     5.39682539762260521377e-02,
     2.18694882948595424599e-02,
     8.86323982359930005737e-03,
     3.59207910759131235356e-03,
     1.45620945432529025516e-03,
     5.88041240820264096874e-04,
     2.46463134818469906812e-04,
     7.81794442939557092300e-05,
     7.14072491382608190305e-05,
    -1.85586374855275456654e-05,
     2.59073051863633712884e-05,
  };

double __kernel_tan(double x, double y, int iy)
{
   double z,r,v,w,s,r1,r2,r3,v1,v2,v3,w2,w4;
   int32_t ix,hx;
   
     {
	ieee_double_shape_type gh_u;
	gh_u.value = (x);
	(hx) = gh_u.parts.msw;
     }

   ix = hx&0x7fffffff;

   if(ix>=0x3FE59428) {
      z = pio4-x;
      w = pio4lo-y;
      x = z+w; y = zero;
   }

   z = x*x;
   w = z*z;

   v1 = T[10]+w*T[12]; w2=w*w;
   v2 = T[6]+w*T[8]; w4=w2*w2;
   v3 = T[2]+w*T[4]; v1=z*v1;
   r1 = T[9]+w*T[11]; v2=z*v2;
   r2 = T[5]+w*T[7]; v3=z*v3;
   r3 = T[1]+w*T[3];
   v = v3 + w2*v2 + w4*v1;
   r = r3 + w2*r2 + w4*r1;

   s = z*x;
   r = y + z*(s*(r+v)+y);
   r += T[0]*s;
   w = x+r;

   if(ix>=0x3FE59428)
     {
	v = (double)iy;
	return (double)(1-((hx>>30)&2))*(v-two*(x-(w*w/(w+v)-r)));
     }

   if(iy==1)
     return w;
   else 
     {
	double a,t;
	z = w;
	  {
	     ieee_double_shape_type sl_u;
	     sl_u.value = (z);
	     sl_u.parts.lsw = (0);
	     (z) = sl_u.value;
	  }
	v = r-(z - x);
	t = a = minus_one/w;
	  {
	     ieee_double_shape_type sl_u;
	     sl_u.value = (t);
	     sl_u.parts.lsw = (0);
	     (t) = sl_u.value;
	  }
	s = one+t*z;
	return t+a*(s+t*v);
     }
}

int main ()
{
   double d = __kernel_tan(0.7, zero, 1);

   if (d > (0.842288 + 0.00001) || d < (0.842288 - 0.00001)) abort ();
   exit (0);
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]