]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR middle-end/88074
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Feb 2019 22:41:26 +0000 (22:41 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Feb 2019 22:41:26 +0000 (22:41 +0000)
PR middle-end/89415
* toplev.c (do_compile): Double the emin/emax exponents to workaround
buggy mpc_norm.

* gcc.dg/pr88074-2.c: New test.

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr88074-2.c [new file with mode: 0644]
gcc/toplev.c

index f164119e29b7ea464701f22d3b4137e1fd9cee58..1babbc7c036964cc3a679e763f00f8ef56d7e4e2 100644 (file)
@@ -1,3 +1,10 @@
+2019-02-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/88074
+       PR middle-end/89415
+       * toplev.c (do_compile): Double the emin/emax exponents to workaround
+       buggy mpc_norm.
+
 2019-02-20  Uroš Bizjak  <ubizjak@gmail.com>
 
        PR target/89397
index 6be764f6ddbb8dba80cba4e2a8904e0bb40b4374..b5e800c68e1c09e99abc9b4d4e09549a9fe4695b 100644 (file)
@@ -1,5 +1,9 @@
 2019-02-20  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/88074
+       PR middle-end/89415
+       * gcc.dg/pr88074-2.c: New test.
+
        PR c++/89336
        * g++.dg/cpp1y/constexpr-89336-3.C: New test.
 
diff --git a/gcc/testsuite/gcc.dg/pr88074-2.c b/gcc/testsuite/gcc.dg/pr88074-2.c
new file mode 100644 (file)
index 0000000..a93c19d
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR middle-end/88074 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-add-options float128 } */
+/* { dg-require-effective-target float128 } */
+/* { dg-final { scan-tree-dump-not "link_error " "optimized" } } */
+
+extern void link_error (void);
+int
+main ()
+{
+  if (((__FLT128_MAX__ * 0.5 + __FLT128_MAX__ * 0.5i)
+       / (__FLT128_MAX__ * 0.25 + __FLT128_MAX__ * 0.25i))
+      != (_Complex _Float128) 2)
+    link_error ();
+  return 0;
+}
index d8096ced677e8dc709fdd47dabfb5c8ab72e97f7..d3719fff443565bb95ceb80968b23c5ca6fd5557 100644 (file)
@@ -2173,8 +2173,12 @@ do_compile ()
                  max_exp = fmt->emax;
              }
          }
-      if (mpfr_set_emin (min_exp)
-         || mpfr_set_emax (max_exp))
+      /* E.g. mpc_norm assumes it can square a number without bothering with
+        with range scaling, so until that is fixed, double the minimum
+        and maximum exponents, plus add some buffer for arithmetics
+        on the squared numbers.  */
+      if (mpfr_set_emin (2 * (min_exp - 1))
+         || mpfr_set_emax (2 * (max_exp + 1)))
        sorry ("mpfr not configured to handle all float modes");
 
       /* Set up the back-end if requested.  */