diff options
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r-- | gcc/ada/exp_ch4.adb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 9acc3e4fa8c..9ec558cca2a 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -9154,8 +9154,16 @@ package body Exp_Ch4 is and then Target_Type /= Operand_Type and then Comes_From_Source (N) then - Insert_Action (N, - Make_Predicate_Check (Target_Type, Duplicate_Subexpr (N))); + declare + New_Expr : constant Node_Id := Duplicate_Subexpr (N); + + begin + -- Avoid infinite recursion on the subsequent expansion of + -- of the copy of the original type conversion. + + Set_Comes_From_Source (New_Expr, False); + Insert_Action (N, Make_Predicate_Check (Target_Type, New_Expr)); + end; end if; end Expand_N_Type_Conversion; |