ada: Fix resolution of mod operator of System.Storage_Elements
commitad16b816d56a2b49adcc9662275a14bf9e4cf6e9
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 23 Feb 2023 18:13:36 +0000 (23 19:13 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 23 May 2023 07:59:06 +0000 (23 09:59 +0200)
treec930d4b9b9df1b6718abd691c0dc02a516d5a168
parent9826f1e019f6abc5f4960dcfd8f7fcf83dc820dc
ada: Fix resolution of mod operator of System.Storage_Elements

This operator is special because the left operand is of Address type while
the right operand and the result are of Storage_Offset type (but we raise
Constraint_Error if the right operand is not positive) and it needs to be
resolved to the type of the left operand to implement the correct semantics.

gcc/ada/

* exp_ch4.adb (Expand_N_Op_Mod): Adjust the detection of the special
operator of System.Storage_Elements.  Do not rewrite it into a rem.
* sem_res.adb (Resolve_Intrinsic_Operator): Use the base type of the
left operand for the special mod operator of System.Storage_Elements
gcc/ada/exp_ch4.adb
gcc/ada/sem_res.adb