Support excess precision for integer / floating-point comparisons (PR c/87390).
commit8313a7643a2cf5f0037e08f4e6a6d7002aeef8a0
authorJoseph Myers <joseph@codesourcery.com>
Wed, 26 Sep 2018 21:14:16 +0000 (26 22:14 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Wed, 26 Sep 2018 21:14:16 +0000 (26 22:14 +0100)
treeca2a8e8b70bfaf75c364c906aa77cfcc45fef4b0
parent01414d53cf3c062ca821de9ae48ba4c3db7d8ad7
Support excess precision for integer / floating-point comparisons (PR c/87390).

In C11, implicit conversions from integer to floating-point types
produce results with the range and precision of the corresponding
evaluation format rather than only those of the type implicitly
converted to.  This patch implements that case of C11 excess precision
semantics in the case of a comparison between integer and
floating-point types, previously missed when implementing other cases
of excess precision for such implicit conversions.  As with other such
fixes, this patch conservatively follows the reading of C99 where
conversions from integer to floating-point do not produce results with
excess precision and so the change is made for C11 mode only.

Bootstrapped with no regressions on x86_64-pc-linux-gnu.

gcc/c:
PR c/87390
* c-typeck.c (build_binary_op): Use excess precision for
comparisons of integers and floating-point for C11 and later.

gcc/testsuite:
PR c/87390
* gcc.target/i386/excess-precision-9.c,
gcc.target/i386/excess-precision-10.c: New tests.

From-SVN: r264656
gcc/c/ChangeLog
gcc/c/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/excess-precision-10.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/excess-precision-9.c [new file with mode: 0644]