summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-cvt-1.c
blob: 3da89afce235376f7c7fd0d8bbf3d0b55ca83ea9 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
cvt-1.c from the execute part of the gcc torture tests.
*/

#include <testfwk.h>

#ifdef __SDCC
#pragma disable_warning 93
#endif

#if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
static inline long
g1 (double x)
{
  return (double) (long) x;
}

long
g2 (double f)
{
  return f;
}

double
f (long i)
{
  if (g1 (i) != g2 (i))
    ASSERT (0);
  return g2 (i);
}
#endif

void
testTortureExecute (void)
{
#if 0 // TODO: Enable when SDCC supports double!
  if (f (123456789L) != 123456789L)
    ASSERT (0);
  if (f (123456789L) != g2 (123456789L))
    ASSERT (0);
  return;
#endif
}