Support excess precision for integer / floating-point comparisons (PR c/87390).
commit2923f790a7dea7429a02f7d481fefec3d14df87b
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 26 Sep 2018 21:14:16 +0000 (26 21:14 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 26 Sep 2018 21:14:16 +0000 (26 21:14 +0000)
treeca2a8e8b70bfaf75c364c906aa77cfcc45fef4b0
parentf580573e104e657ba64709e3b7475a5d5a603f90
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264656 138bc75d-0d04-0410-961f-82ee72b054a4
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]