[Bug tree-optimization/88074] [7/8/9 Regression] g++ hangs on math expression

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 20 10:23:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88074

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu.org

--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
So based on some code in the Fortran FE I used

      machine_mode mode;
      int min_exp = -1;
      int max_exp = 1;
      FOR_EACH_MODE_IN_CLASS (mode, MODE_FLOAT)
        if (SCALAR_FLOAT_MODE_P (mode))
          {
            const real_format *fmt = REAL_MODE_FORMAT (mode);
            if (fmt)
              {
                if (fmt->emin < min_exp)
                  min_exp = fmt->emin - fmt->p + 1;
^^^

                if (fmt->emax > max_exp)
                  max_exp = fmt->emax;
              }
          }
      if (mpfr_set_emin (min_exp)
          || mpfr_set_emax (max_exp))
        sorry ("mpfr not configured to handle all float modes");

but that ICEs in real_to_decimal_for_mode for the float128*.c tests for
example for 6.47517511943802511092443895822764655e-4966.  The real
number has an exponent of -16493 but the format is

$17 = {encode = 
    0x103a237 <encode_ieee_extended_intel_128(real_format const*, long*,
real_value const*)>, decode = 
    0x103a5b3 <decode_ieee_extended_intel_128(real_format const*, real_value*,
long const*)>, b = 2, p = 64, pnan = 64, emin = -16381, emax = 16384, 
  signbit_ro = 79, signbit_rw = 79, ieee_bits = 65, 
  round_towards_zero = false, has_sign_dependent_rounding = true, 
  has_nans = true, has_inf = true, has_denorm = true, has_signed_zero = true, 
  qnan_msb_set = true, canonical_nan_lsbs_set = false, 
  name = 0x21f3a60 "ieee_extended_intel_128"}

so somehow the formula fmt->emin - fmt->p + 1 isn't sufficient (that's
used for Fortrans "denormalization").  Given I use a global emin/emax
independent on the modes of the actual constant folding (just to limit
computational effort in mpfr) I can of course simply apply a factor of two
for safety but what's special about ieee_extended_intel_128 here?
(the number is __FLT128_DENORM_MIN__).

Joseph, what's the magic with fmt->emin and denormals?  The subtraction
of fmt->p should have accounted for all?


More information about the Gcc-bugs mailing list