]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Fix missing Overflow and Range checks
authorMarc Poulhiès <poulhies@adacore.com>
Fri, 17 Jun 2022 14:07:35 +0000 (16:07 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 12 Jul 2022 12:24:10 +0000 (12:24 +0000)
commit1ef1ac768ff108a6a2c08e18eec3309e182df142
tree6320c0b697e8e6e537e34059d30f665686e3226d
parent829b5a6075e63e84600b0eee5daebb3fab9aa491
[Ada] Fix missing Overflow and Range checks

While doing Preanalysis (as is the case during ghost code handling),
some range and/or overflow checks can be saved (see Saved_Checks in
checks.adb) and later one omitted as they would be redundant (see
Find_Check in checks.adb). In the case of ghost code, the node being
Preanalyzed is a temporary copy that is discarded, so its corresponding
check is not expanded later. The node that gets expanded later is not
having any checks expanded as it is wrongly assumed it has already been
done before.

As is already the case in Preanalyze_And_Resolve, this change suppresses
all checks during Preanalyze except for GNATprove mode.

gcc/ada/

* sem.adb (Preanalyze): Suppress checks when not in GNATprove
mode.
* sem_res.adb (Preanalyze_And_Resolve): Add cross reference in
comment to above procedure.
* sinfo.ads: Typo fix in comment.
gcc/ada/sem.adb
gcc/ada/sem_res.adb
gcc/ada/sinfo.ads