From 35f4f238400a5527ee68546c03e320768f01bc48 Mon Sep 17 00:00:00 2001 From: Javier Miranda Date: Thu, 21 Apr 2016 09:18:57 +0000 Subject: [PATCH] exp_aggr.adb (Component_Check): Extend the check that verifies that the aggregate has no function calls to... 2016-04-21 Javier Miranda * exp_aggr.adb (Component_Check): Extend the check that verifies that the aggregate has no function calls to handle transformations performed by the frontend. (Ultimate_Original_Expression): New subprogram. From-SVN: r235321 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/exp_aggr.adb | 29 ++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c06c004f2c9..2fc027e453f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2016-04-21 Javier Miranda + + * exp_aggr.adb (Component_Check): Extend + the check that verifies that the aggregate has no function + calls to handle transformations performed by the frontend. + (Ultimate_Original_Expression): New subprogram. + 2016-04-21 Philippe Gil * krunch.adb (Krunch): Fix krunching of i-java. diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index efaee5e6766..6d6e1a25263 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -564,6 +564,30 @@ package body Exp_Aggr is --------------------- function Component_Check (N : Node_Id; Index : Node_Id) return Boolean is + + function Ultimate_Original_Expression (N : Node_Id) return Node_Id; + -- Given a type conversion or an unchecked type conversion N, return + -- its innermost original expression. + + ---------------------------------- + -- Ultimate_Original_Expression -- + ---------------------------------- + + function Ultimate_Original_Expression (N : Node_Id) return Node_Id is + Expr : Node_Id := Original_Node (N); + + begin + while Nkind_In (Expr, N_Type_Conversion, + N_Unchecked_Type_Conversion) + loop + Expr := Original_Node (Expression (Expr)); + end loop; + + return Expr; + end Ultimate_Original_Expression; + + -- Local variables + Expr : Node_Id; begin @@ -617,7 +641,10 @@ package body Exp_Aggr is -- Checks 12: (no function call) - if Modify_Tree_For_C and then Nkind (Expr) = N_Function_Call then + if Modify_Tree_For_C + and then + Nkind (Ultimate_Original_Expression (Expr)) = N_Function_Call + then return False; end if; -- 2.30.2