about summary refs log tree commit diff homepage
path: root/test/Feature/LongDoubleSupport.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Feature/LongDoubleSupport.c')
-rw-r--r--test/Feature/LongDoubleSupport.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/test/Feature/LongDoubleSupport.c b/test/Feature/LongDoubleSupport.c
index b4631832..185a5485 100644
--- a/test/Feature/LongDoubleSupport.c
+++ b/test/Feature/LongDoubleSupport.c
@@ -1,8 +1,9 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --exit-on-error %t1.bc > %t2.out
+// RUN: %klee --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
@@ -10,11 +11,29 @@
 // constants, we don't actually end up seeing much code which uses long
 // double.
 int main() {
-  long double a = LDBL_MAX;
-  long double b = -1;
-  long double c = a + b;
-  printf("a = %Lg\n", a);
-  printf("b = %Lg\n", b);
-  printf("c = %Lg\n", c);
+  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;
 }