[Ada] Overhaul code implementing conversions involving fixed-point types

Programming / Compilers / GCC - pmderodat [138bc75d-0d04-0410-961f-82ee72b054a4] - 22 July 2019 13:58 EDT

This ovehauls the code implementing conversions involving fixed-point types in the front-end because it leaks the Do_Range_Check flag in several places to the back-end, which is a violation of the documented interface between front-end and back-end.

This also does a bit of housekeeping work throughout it in the process.

There should be essentially no functional changes.

2019-07-22 Eric Botcazou

gcc/ada/

- checks.adb (Apply_Type_Conversion_Checks): Do not set Do_Range_Check flag on conversions from fixed-point types either.
- exp_attr.adb: Add use and with clause for Expander. (Expand_N_Attribute_Reference) : Set the Conversion_OK flag and do not generate overflow/range checks manually.
- exp_ch4.adb (Expand_N_Qualified_Expression): Remove superfluous clearing of Do_Range_Check flag. (Discrete_Range_Check): New procedure to generate a range check for discrete types. (Real_Range_Check): Remove redundant local variable and adjust. Remove useless shortcut. Clear Do_Range_Check flag on all paths. (Expand_N_Type_Conversion): Remove redundant test on Conversion_OK. Call Discrete_Range_Check to generate range checks on discrete types. Remove obsolete code for float-to-integer conversions. Add code to generate range checks for conversions involving fixed-point types.

72c474b5023 [Ada] Overhaul code implementing conversions involving fixed-point types
gcc/ada/ChangeLog | 22 +++++
gcc/ada/checks.adb | 5 +-
gcc/ada/exp_attr.adb | 74 +++------------
gcc/ada/exp_ch4.adb | 251 +++++++++++++++++++++------------------------------
4 files changed, 142 insertions(+), 210 deletions(-)

Upstream: gcc.gnu.org


  • Share