summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-21 09:18:57 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-21 09:18:57 +0000
commitadf0828888e30a855cdd5a725c647b2e58e1ff46 (patch)
treecab41dc20b5cb75646145ac3e00a73e162b7ee4b
parent4f187ca271877fd2d0f6ad5d0ad2044c12a7676f (diff)
downloadgcc-adf0828888e30a855cdd5a725c647b2e58e1ff46.tar.gz
2016-04-21 Javier Miranda <miranda@adacore.com>
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235321 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/exp_aggr.adb29
2 files changed, 35 insertions, 1 deletions
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 <miranda@adacore.com>
+
+ * 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 <gil@adacore.com>
* 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;