aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr70457.c
blob: 74daed4d36f6ff448ddf7bd40d78afaee64d1653 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* { dg-do compile } */

/* This formerly ICEd when trying to expand pow as a built-in with
   the wrong number of arguments.  */

extern double pow (double, double) __attribute__ ((__nothrow__ , __leaf__));

typedef struct {
  long long data;
  int tag;
} Object;

extern Object Make_Flonum (double);
extern Object P_Pow (Object, Object);

Object General_Function (Object x, Object y, double (*fun)()) {
  double d, ret;

  d = 1.0;

  if (y.tag >> 1)
    ret = (*fun) (d);
  else
    ret = (*fun) (d, 0.0);

  return Make_Flonum (ret);
}

Object P_Pow (Object x, Object y) { return General_Function (x, y, pow); }