1/* { dg-do run } */
2union double_union
3{
4  double d;
5  int i[2];
6};
7void _dtoa_r (double) __attribute__ ((__noinline__));
8void _vfprintf_r (double) __attribute__ ((__noinline__));
9void
10__sprint_r(int);
11void
12_vfprintf_r(double da)
13{
14 double ffp = da;
15 double value = ffp;
16 union double_union tmp;
17
18 tmp.d = value;
19
20 if ((tmp.i[1]) & ((unsigned)0x80000000L)) {
21   value = -value;
22 }
23
24 _dtoa_r (value);
25
26 if (ffp != 0)
27   __sprint_r(value == 0);
28 __asm__ ("");
29}
30
31
32double dd = -.012;
33double ff = .012;
34
35void exit (int) __attribute__ ((__noreturn__));
36void abort (void) __attribute__ ((__noreturn__));
37void *memset(void *s, int c, __SIZE_TYPE__ n);
38void _dtoa_r (double d)
39{
40  if (d != ff)
41    abort ();
42  __asm__ ("");
43}
44
45void __sprint_r (int i)
46{
47  if (i != 0)
48    abort ();
49  __asm__ ("");
50}
51
52int clearstack (void) __attribute__ ((__noinline__));
53int clearstack (void)
54{
55  char doodle[128];
56  memset (doodle, 0, sizeof doodle);
57  __asm__ volatile ("" : : "g" (doodle) : "memory");
58  return doodle[127];
59}
60
61void doit (void) __attribute__ ((__noinline__));
62void doit (void)
63{
64  _vfprintf_r (dd);
65  _vfprintf_r (ff);
66  __asm__ ("");
67}
68
69int main(void)
70{
71  clearstack ();
72  doit ();
73  exit (0);
74}
75