On Wed, Feb 20, 2019 at 11:13:54AM +0000, Andrew Stubbs wrote: > This patch causes a number of test regressions for (at least) arm and > amdgcn. I've run a bisect and confirmed this is the first commit where it > doesn't work.
The following, so far untested (except for x86_64->armv7hl-linux-gnueabi cross on the builtin-math-7.c testcase and x86_64-linux native on the pr88074* testcases) patch should cure this, will bootstrap/regtest it tonight. 2019-02-20 Jakub Jelinek <ja...@redhat.com> PR middle-end/88074 * toplev.c (do_compile): Double the emin/emax exponents to workaround buggy mpc_norm. * gcc.dg/pr88074-2.c: New test. --- gcc/toplev.c.jj 2019-02-20 10:00:49.290492694 +0100 +++ gcc/toplev.c 2019-02-20 14:04:27.037769362 +0100 @@ -2173,8 +2173,12 @@ do_compile () max_exp = fmt->emax; } } - if (mpfr_set_emin (min_exp) - || mpfr_set_emax (max_exp)) + /* 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. */ --- gcc/testsuite/gcc.dg/pr88074-2.c.jj 2019-02-20 14:10:07.109140297 +0100 +++ gcc/testsuite/gcc.dg/pr88074-2.c 2019-02-20 14:09:46.696478179 +0100 @@ -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; +} Jakub