aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2016-04-21 09:18:57 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2016-04-21 11:18:57 +0200
commit35f4f238400a5527ee68546c03e320768f01bc48 (patch)
treecab41dc20b5cb75646145ac3e00a73e162b7ee4b
parenta1ad79ed6381825971cccac3c1bdc7dd4d3b11da (diff)
downloadgcc-35f4f238400a5527ee68546c03e320768f01bc48.zip
gcc-35f4f238400a5527ee68546c03e320768f01bc48.tar.gz
gcc-35f4f238400a5527ee68546c03e320768f01bc48.tar.bz2
exp_aggr.adb (Component_Check): Extend the check that verifies that the aggregate has no function calls to...
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. From-SVN: r235321
-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 c06c004..2fc027e 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 efaee5e..6d6e1a2 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;