New testcase
authorChris Lattner <sabre@nondot.org>
Wed, 21 May 2003 23:01:50 +0000 (23:01 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 21 May 2003 23:01:50 +0000 (23:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6278 91177308-0d34-0410-b5e6-96231b3b80d8

test/C++Frontend/2003-05-21-UnionBitfields.c [new file with mode: 0644]

diff --git a/test/C++Frontend/2003-05-21-UnionBitfields.c b/test/C++Frontend/2003-05-21-UnionBitfields.c
new file mode 100644 (file)
index 0000000..b9d954a
--- /dev/null
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <math.h>
+
+int target_isinf(double x) {
+  union {
+    double d;
+    struct {
+      unsigned mantissa2;
+      unsigned mantissa1 : 20;
+      unsigned exponent  : 11;
+      unsigned sign      :  1;
+    } big_endian;
+  } u;
+
+  u.d = x;
+  return (u.big_endian.exponent == 2047 && u.big_endian.mantissa1 == 0 && u.big_endian.mantissa2 == 0);
+}
+
+int main() {
+  printf("%d %d\n", target_isinf(1234.42), target_isinf(INFINITY));
+  return 0;
+}