summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/compile/981007-1.c
blob: d41400b7832b5809a09a7a8db225597d7bab2347 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
extern double fabs (double);
extern double sqrt (double);

typedef struct complexm {
  double re,im;
} complex;

static complex
setCom (double r, double i)
{
  complex ct;
  ct.re=fabs(r)<1E-300?0.0:r;
  ct.im=fabs(i)<1E-300?0.0:i;
  return ct;
}

static complex
csqrt_crash (double x)
{
  return (x>=0) ? setCom(sqrt(x),0) : setCom(0,sqrt(-x));
}