diff options
author | Chris Lattner <sabre@nondot.org> | 2003-05-21 23:01:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-05-21 23:01:50 +0000 |
commit | 45aebdd04af0b3fa7b6ee09d133e2709e7b78c2e (patch) | |
tree | 817cfc3adad57e9cfe5af4abf8d1d23783868258 /test/C++Frontend | |
parent | afb0e71e22369e06866b409704350eeece9075e2 (diff) | |
download | external_llvm-45aebdd04af0b3fa7b6ee09d133e2709e7b78c2e.zip external_llvm-45aebdd04af0b3fa7b6ee09d133e2709e7b78c2e.tar.gz external_llvm-45aebdd04af0b3fa7b6ee09d133e2709e7b78c2e.tar.bz2 |
New testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/C++Frontend')
-rw-r--r-- | test/C++Frontend/2003-05-21-UnionBitfields.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/C++Frontend/2003-05-21-UnionBitfields.c b/test/C++Frontend/2003-05-21-UnionBitfields.c new file mode 100644 index 0000000..b9d954a --- /dev/null +++ b/test/C++Frontend/2003-05-21-UnionBitfields.c @@ -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; +} |