about summary refs log tree commit diff homepage
path: root/test/Feature/LongDoubleSupport.c
blob: 4ea9daee629f6d3f4c4dcd9a1635ba7ac5b23d64 (plain) (blame)
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
// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out --optimize=0 --exit-on-error %t1.bc > %t2.out

#include <stdio.h>
#include <float.h>
#include <assert.h>

// FIXME: This doesn't really work at all, it just doesn't
// crash. Until we have wide constant support, that is all we care
// about; the only reason this comes up is in initialization of
// constants, we don't actually end up seeing much code which uses long
// double.
int main() {
  unsigned N0 = 0, N1 = 0, N2 = 0;

  float V0 = .1;
  while (V0 != 0) {
    V0 *= V0;
    N0++;
  }
  double V1 = .1;
  while (V1 != 0) {
    V1 *= V1;
    N1++;
  }
  long double V2 = .1;
  while (V2 != 0) {
    V2 *= V2;
    N2++;
  }

  printf("counts: %d, %d, %d\n", N0, N1, N2);

  assert(N0 == 6);
  assert(N1 == 9);
  assert(N2 == 13);

  return 0;
}