aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr70457.c
blob: e0a212f1dbc2a412cc321d07db6a6b8e8f67bc6d (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
30
/* { dg-do compile } */
/* { dg-additional-options "-std=gnu17" } */

/* 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); }