]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Add support for No_Implicit_Conditionals to nonbinary modular types
authorEric Botcazou <ebotcazou@adacore.com>
Sat, 20 Apr 2024 08:53:16 +0000 (10:53 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 10 Jun 2024 09:04:01 +0000 (11:04 +0200)
commit627244477949da068456dc195a88be5437e11d02
tree55ebb05fb990254cb563ca5c665335409e193aa9
parentadd6d89eaed4070803882b9a0b643d963ca8d80a
ada: Add support for No_Implicit_Conditionals to nonbinary modular types

The expansion of additive operations for nonbinary modular types implemented
in the front-end and its counterpart in code generators may create branches,
which is not allowed when restriction No_Implicit_Conditionals is in effect.

This changes it to use an explicit Mod operation when the restriction is in
effect, which is assumed not to create such branches.

gcc/ada/

* exp_ch4.adb (Expand_Nonbinary_Modular_Op): Create an explicit Mod
for additive operations if No_Implicit_Conditionals is in effect.
(Expand_Modular_Addition): Likewise.
(Expand_Modular_Subtraction): Likewise.
(Expand_Modular_Op): Always use an unsigned type obtained by calling
Small_Integer_Type_For on the required size.
gcc/ada/exp_ch4.adb