diff options
author | Javier Miranda <miranda@adacore.com> | 2021-02-18 13:47:10 -0500 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-06-16 04:42:58 -0400 |
commit | cbb64f6b9ac870176700a2fa723a3b21a53b9b29 (patch) | |
tree | 0f5b5ef319b4837ee7148b452a60ab322c7b3025 | |
parent | a2d2310d80ae992306f97764a850c56e70a1a8e3 (diff) | |
download | gcc-cbb64f6b9ac870176700a2fa723a3b21a53b9b29.zip gcc-cbb64f6b9ac870176700a2fa723a3b21a53b9b29.tar.gz gcc-cbb64f6b9ac870176700a2fa723a3b21a53b9b29.tar.bz2 |
[Ada] ACATS 4.1R-c611a04: Class-wide preconditions in dispatching calls
gcc/ada/
* exp_disp.adb (Build_Class_Wide_Check): Ensure that evaluation
of actuals is side effects free (since the check duplicates
actuals).
-rw-r--r-- | gcc/ada/exp_disp.adb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 20a32cd..eb6b352 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -868,6 +868,7 @@ package body Exp_Disp is Str_Loc : constant String := Build_Location_String (Loc); + A : Node_Id; Cond : Node_Id; Msg : Node_Id; Prec : Node_Id; @@ -900,6 +901,15 @@ package body Exp_Disp is return; end if; + -- Ensure that the evaluation of the actuals will not produce side + -- effects (since the check will use a copy of the actuals). + + A := First_Actual (Call_Node); + while Present (A) loop + Remove_Side_Effects (A); + Next_Actual (A); + end loop; + -- The expression for the precondition is analyzed within the -- generated pragma. The message text is the last parameter of -- the generated pragma, indicating source of precondition. |