aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@gcc.gnu.org>2004-11-10 19:06:53 +0000
committerFariborz Jahanian <fjahanian@gcc.gnu.org>2004-11-10 19:06:53 +0000
commitfdc7e5d00e0d577852dd17d6207750e8efacda0e (patch)
tree2e465d717b7fafa9bb2c9c26fa31192afb0f5a54 /gcc
parent9e5712a5c373f4aee54055d4f7a5642090dfcf63 (diff)
downloadgcc-fdc7e5d00e0d577852dd17d6207750e8efacda0e.zip
gcc-fdc7e5d00e0d577852dd17d6207750e8efacda0e.tar.gz
gcc-fdc7e5d00e0d577852dd17d6207750e8efacda0e.tar.bz2
Test for PR tree-optimization/17892.
From-SVN: r90447
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c
new file mode 100644
index 0000000..c15653c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c
@@ -0,0 +1,37 @@
+extern void abort();
+
+typedef union {
+ struct {
+ unsigned int hi;
+ unsigned int lo;
+ } i;
+ double d;
+} hexdouble;
+
+static const double twoTo52 = 0x1.0p+52;
+
+void func ( double x )
+{
+ hexdouble argument;
+ register double y, z;
+ unsigned int xHead;
+ argument.d = x;
+ xHead = argument.i.hi & 0x7fffffff;
+ if (__builtin_expect(!!(xHead < 0x43300000u), 1))
+ {
+ y = ( x - twoTo52 ) + twoTo52;
+ if ( y != x )
+ abort();
+ z = x - 0.5;
+ y = ( z - twoTo52 ) + twoTo52;
+ if ( y == (( x - twoTo52 ) + twoTo52) )
+ abort();
+ }
+ return;
+}
+
+int main()
+{
+ func((double)1.00);
+ return 0;
+}