diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-10-14 09:33:23 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-10-14 09:33:23 +0200 |
commit | 16ec267063c8ce60769888d4097bcd158410adc8 (patch) | |
tree | 372e0a315c682ba28d7c5e3f6347037bfd92a0cf /libgcc/config/i386/64/sfp-machine.h | |
parent | 98e341130f87984af07c884fea773c0bb3cc8821 (diff) | |
download | gcc-16ec267063c8ce60769888d4097bcd158410adc8.tar.gz |
c++: Excess precision for ? int : float or int == float [PR107097, PR82071, PR87390]
The following incremental patch implements the C11 behavior (for all C++
versions) for
cond ? int : float
cond ? float : int
int cmp float
float cmp int
where int is any integral type, float any floating point type with
excess precision and cmp ==, !=, >, <, >=, <= and <=>.
2022-10-14 Jakub Jelinek <jakub@redhat.com>
PR c/82071
PR c/87390
PR c++/107097
gcc/cp/
* cp-tree.h (cp_ep_convert_and_check): Remove.
* cvt.cc (cp_ep_convert_and_check): Remove.
* call.cc (build_conditional_expr): Use excess precision for ?: with
one arm floating and another integral. Don't convert first to
semantic result type from integral types.
(convert_like_internal): Don't call cp_ep_convert_and_check, instead
just strip EXCESS_PRECISION_EXPR before calling cp_convert_and_check
or cp_convert.
* typeck.cc (cp_build_binary_op): Set may_need_excess_precision
for comparisons or SPACESHIP_EXPR with at least one operand integral.
Don't compute semantic_result_type if build_type is non-NULL. Call
cp_convert_and_check instead of cp_ep_convert_and_check.
gcc/testsuite/
* gcc.target/i386/excess-precision-8.c: For C++ wrap abort and
exit declarations into extern "C" block.
* gcc.target/i386/excess-precision-10.c: Likewise.
* g++.target/i386/excess-precision-7.C: Remove.
* g++.target/i386/excess-precision-8.C: New test.
* g++.target/i386/excess-precision-9.C: Remove.
* g++.target/i386/excess-precision-10.C: New test.
* g++.target/i386/excess-precision-12.C: New test.
Diffstat (limited to 'libgcc/config/i386/64/sfp-machine.h')
0 files changed, 0 insertions, 0 deletions