This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fold_inf_compare broken for float formats without infinities


Richard Guenther wrote:

> Hm, why does REAL_VALUE_ISINF (cst) return true?  Or rather, why do we
> have r->cl == rvc_inf ever if the mode does not support infinities?

Well, in this particular case because __builtin_huge_valf will always
construct a REAL_VALUE_TYPE of class rvc_inf.  It's translated into FLT_MAX
by encode_ieee_single if the target type does not support infinity.

Maybe this is actually wrong, and __builtin_huge_valf should itself
construct a FLT_MAX value.  However, there are a number of other cases
where rvc_inf values are constructed internally, unconditionally, e.g.
in the case of arithmetic overflows ...

> Doesn't that mean that constant folding results will differ from what
> the hardware would compute?

Possibly.  However, that could be the case anyway, right?  Constant
folding performs all operations in the internal format, and only rounds
once at the end -- if the operations would have been done on the 
hardware, we've have had rounding after each step ...
 
> Anyway, I think the patch is ok at this stage, but maybe there are more
> of these corner case bugs due to the above.

OK, thanks.  I've committed the patch for now.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]