aboutsummaryrefslogtreecommitdiff
path: root/gcc/bitmap.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-07-23 08:13:32 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-07-23 08:13:32 +0000
commit67460d45757a79cdc91fdde1dc1b1a18e4aba6b2 (patch)
tree0876647d905aa74a9b990478eec99495ac5572c6 /gcc/bitmap.c
parenta7191e01187b6ff6429699f09fed8f3fbb018b74 (diff)
downloadgcc-67460d45757a79cdc91fdde1dc1b1a18e4aba6b2.zip
gcc-67460d45757a79cdc91fdde1dc1b1a18e4aba6b2.tar.gz
gcc-67460d45757a79cdc91fdde1dc1b1a18e4aba6b2.tar.bz2
[Ada] Plug small loophole in Generate_Range_Check
The Generate_Range_Check routine is responsible for generating range checks in the scalar case. It automatically deals with possible overflow in the process when the source and the target base types are different. However there is one case where overflow is not dealt with correctly, namely when the target base type is narrower than the source base type and both are floating-point types. In this case, the routine will convert the source type to the target base type without checking for overflow. In practice this does not matter much because the conversion would yield an infinity on overflow, which would then fail the subsequent range check. However it's more correct to have a proper overflow check with -gnateF than relying on the infinity. 2019-07-23 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * checks.adb (Convert_And_Check_Range): Add Suppress parameter and pass it in the call to Insert_Actions. Rename local variable. (Generate_Range_Check): Minor comment fixes. Pass Range_Check in the first call to Convert_And_Check_Range and All_Checks in the second call. * exp_ch4.adb (Expand_N_Type_Conversion): Reset the Do_Overflow_Check flag in the float-to-float case too if there is also a range check. gcc/testsuite/ * gnat.dg/range_check5.adb: New testcase. From-SVN: r273725
Diffstat (limited to 'gcc/bitmap.c')
0 files changed, 0 insertions, 0 deletions