OSDN Git Service

PR target/36332
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Sep 2008 18:46:29 +0000 (18:46 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Sep 2008 18:46:29 +0000 (18:46 +0000)
* real.c (real_maxval): Clear a lower bit to make real_maxval
match get_max_float for IBM long double format.

* gcc.c-torture/execute/ieee/pr36332.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139906 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/real.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/ieee/pr36332.c [new file with mode: 0644]

index 0179e92..670d5f3 100644 (file)
@@ -1,3 +1,9 @@
+2008-09-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/36332
+       * real.c (real_maxval): Clear a lower bit to make real_maxval
+       match get_max_float for IBM long double format.
+
 2008-09-02  Andreas Schwab  <schwab@suse.de>
 
        * configure.ac: Use m4_quote to quote the expansion of m4_do.
index 886f8b4..dc6d748 100644 (file)
@@ -2417,7 +2417,7 @@ real_maxval (REAL_VALUE_TYPE *r, int sign, enum machine_mode mode)
           required to be the value of the long double rounded to the
           nearest double.  Rounding means we need a slightly smaller
           value for LDBL_MAX.  */
-        clear_significand_bit (r, SIGNIFICAND_BITS - fmt->pnan);
+       clear_significand_bit (r, SIGNIFICAND_BITS - fmt->pnan - 1);
     }
 }
 
index b30e345..f9fdc55 100644 (file)
@@ -1,5 +1,8 @@
 2008-09-02  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/36332
+       * gcc.c-torture/execute/ieee/pr36332.c: New test.
+
        PR c/37171
        * g++.dg/ext/attrib34.C: New test.
 
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/pr36332.c b/gcc/testsuite/gcc.c-torture/execute/ieee/pr36332.c
new file mode 100644 (file)
index 0000000..b22fd5d
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR target/36332 */
+
+int __attribute__((noinline, used))
+foo (long double ld)
+{
+  return ld == __builtin_infl ();
+}
+
+int
+main ()
+{
+  if (foo (__LDBL_MAX__))
+    __builtin_abort ();
+  return 0;
+}