-
- Downloads
Don't simplify NAN/INF or out-of-range constant for FIX/UNSIGNED_FIX.
According to IEEE standard, for conversions from floating point to integer. When a NaN or infinite operand cannot be represented in the destination format and this cannot otherwise be indicated, the invalid operation exception shall be signaled. When a numeric operand would convert to an integer outside the range of the destination format, the invalid operation exception shall be signaled if this situation cannot otherwise be indicated. The patch prevent simplication of the conversion from floating point to integer for NAN/INF/out-of-range constant when flag_trapping_math. gcc/ChangeLog: PR rtl-optimization/100927 PR rtl-optimization/115161 PR rtl-optimization/115115 * simplify-rtx.cc (simplify_const_unary_operation): Prevent simplication of FIX/UNSIGNED_FIX for NAN/INF/out-of-range constant when flag_trapping_math. * fold-const.cc (fold_convert_const_int_from_real): Don't fold for overflow value when_trapping_math. gcc/testsuite/ChangeLog: * gcc.dg/pr100927.c: New test. * c-c++-common/Wconversion-1.c: Add -fno-trapping-math. * c-c++-common/dfp/convert-int-saturate.c: Ditto. * g++.dg/ubsan/pr63956.C: Ditto. * g++.dg/warn/Wconversion-real-integer.C: Ditto. * gcc.c-torture/execute/20031003-1.c: Ditto. * gcc.dg/Wconversion-complex-c99.c: Ditto. * gcc.dg/Wconversion-real-integer.c: Ditto. * gcc.dg/c90-const-expr-11.c: Ditto. * gcc.dg/overflow-warn-8.c: Ditto.
Showing
- gcc/fold-const.cc 12 additions, 1 deletiongcc/fold-const.cc
- gcc/simplify-rtx.cc 19 additions, 4 deletionsgcc/simplify-rtx.cc
- gcc/testsuite/c-c++-common/Wconversion-1.c 1 addition, 1 deletiongcc/testsuite/c-c++-common/Wconversion-1.c
- gcc/testsuite/c-c++-common/dfp/convert-int-saturate.c 1 addition, 0 deletionsgcc/testsuite/c-c++-common/dfp/convert-int-saturate.c
- gcc/testsuite/g++.dg/ubsan/pr63956.C 6 additions, 1 deletiongcc/testsuite/g++.dg/ubsan/pr63956.C
- gcc/testsuite/g++.dg/warn/Wconversion-real-integer.C 1 addition, 1 deletiongcc/testsuite/g++.dg/warn/Wconversion-real-integer.C
- gcc/testsuite/gcc.c-torture/execute/20031003-1.c 2 additions, 0 deletionsgcc/testsuite/gcc.c-torture/execute/20031003-1.c
- gcc/testsuite/gcc.dg/Wconversion-complex-c99.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/Wconversion-complex-c99.c
- gcc/testsuite/gcc.dg/Wconversion-real-integer.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/Wconversion-real-integer.c
- gcc/testsuite/gcc.dg/c90-const-expr-11.c 1 addition, 1 deletiongcc/testsuite/gcc.dg/c90-const-expr-11.c
- gcc/testsuite/gcc.dg/overflow-warn-8.c 1 addition, 0 deletionsgcc/testsuite/gcc.dg/overflow-warn-8.c
- gcc/testsuite/gcc.dg/pr100927.c 31 additions, 0 deletionsgcc/testsuite/gcc.dg/pr100927.c
Loading
Please register or sign in to comment