]> gcc.gnu.org Git - gcc.git/commit - gcc/ada/exp_attr.adb
[Ada] Overhaul code implementing conversions involving fixed-point types
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 22 Jul 2019 13:58:19 +0000 (13:58 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 22 Jul 2019 13:58:19 +0000 (13:58 +0000)
commit8113b0c7385727d9969db2c8420bc0a3d6b8f0ed
tree7867ec78d1a4964669ee03eb5e1741a1e0834d03
parentc936411fab42b991839ce8cd95a5d883867f9466
[Ada] Overhaul code implementing conversions involving fixed-point types

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  <ebotcazou@adacore.com>

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) <Fixed_Value, Integer_Value>: 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.

From-SVN: r273692
gcc/ada/ChangeLog
gcc/ada/checks.adb
gcc/ada/exp_attr.adb
gcc/ada/exp_ch4.adb
This page took 0.067578 seconds and 5 git commands to generate.