This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][C-Family] Disable bogus shortening of DFP vs FP compare
- From: Richard Biener <rguenther at suse dot de>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 4 Nov 2014 17:03:41 +0100 (CET)
- Subject: Re: [PATCH][C-Family] Disable bogus shortening of DFP vs FP compare
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1411041558320 dot 8401 at zhemvz dot fhfr dot qr> <alpine dot DEB dot 2 dot 10 dot 1411041554480 dot 17854 at digraph dot polyomino dot org dot uk>
On Tue, 4 Nov 2014, Joseph Myers wrote:
> On Tue, 4 Nov 2014, Richard Biener wrote:
>
> > c-family/
> > * c-common.c (shorten_compare): Do not shorten mixed
> > DFP and non-DFP compares.
>
> OK. I think it's also wrong for get_narrower to strip conversions between
> binary and decimal floating point at all, as all such conversions for
> supported pairs of types can change values. (_Decimal128 can represent
> all values of __fp16, but no target currently supports both types.) And
> if flag_signaling_nans (strictly, if HONOR_SNANS (source-mode)), no
> floating-point conversions should be stripped in get_narrower at all. And
> even without signaling NaNs, TYPE_PRECISION may not be a reliable
> indication of whether a conversion is widening - the only issue applying
> at present might be the corner case that a conversion of a subnormal from
> __float80 to __float128 is exact but still raises "underflow" if traps on
> underflow are enabled, but when you have both binary128 and IBM long
> double supported together then neither has a set of values that is a
> superset of the other (it seems
> <https://gcc.gnu.org/ml/gcc-patches/2014-07/msg01086.html> misses
> get_narrower in the places that need addressing).
>From this and past issues it looks like most (if not all) conversions
between FP types use CONVERT_EXPR, not NOP_EXPR and thus may work
"as expected" here. That's of course somewhat unreliable as the
middle-end happily uses NOP_EXPR for those.
Richard.