This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fold_inf_compare broken for float formats without infinities
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: richard dot guenther at gmail dot com (Richard Guenther)
- Cc: gcc-patches at gcc dot gnu dot org, trevor_smigiel at playstation dot sony dot com, andrew_pinski at playstation dot sony dot com
- Date: Wed, 11 Mar 2009 16:29:00 +0100 (CET)
- Subject: 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