aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2011-01-04 09:43:56 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-01-04 09:43:56 +0000
commit0394741f9b89489efdd72c95fae7d2867065a72b (patch)
treeb28d2267f1c974afa881f7d0c877433b2819c66f /gcc
parent2a02d0907c0b500018ba900e93239e1b03281c67 (diff)
downloadgcc-0394741f9b89489efdd72c95fae7d2867065a72b.zip
gcc-0394741f9b89489efdd72c95fae7d2867065a72b.tar.gz
gcc-0394741f9b89489efdd72c95fae7d2867065a72b.tar.bz2
trans.c (Subprogram_Body_to_gnu): Evaluate the expressions of the parameter cache within the statement group of...
* gcc-interface/trans.c (Subprogram_Body_to_gnu): Evaluate the expressions of the parameter cache within the statement group of the CICO mechanism. From-SVN: r168456
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/gcc-interface/trans.c50
2 files changed, 31 insertions, 25 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 57d9c58..f644a55 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (Subprogram_Body_to_gnu): Evaluate the
+ expressions of the parameter cache within the statement group of
+ the CICO mechanism.
+
2011-01-04 Olivier Hainque <hainque@adacore.com>
Eric Botcazou <ebotcazou@adacore.com>
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 9bf7c3d..ecd9489 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -2603,6 +2603,31 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
gnat_poplevel ();
gnu_result = end_stmt_group ();
+ /* If we populated the parameter attributes cache, we need to make sure that
+ the cached expressions are evaluated on all the possible paths leading to
+ their uses. So we force their evaluation on entry of the function. */
+ cache = DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language->parm_attr_cache;
+ if (cache)
+ {
+ struct parm_attr_d *pa;
+ int i;
+
+ start_stmt_group ();
+
+ FOR_EACH_VEC_ELT (parm_attr, cache, i, pa)
+ {
+ if (pa->first)
+ add_stmt_with_node_force (pa->first, gnat_node);
+ if (pa->last)
+ add_stmt_with_node_force (pa->last, gnat_node);
+ if (pa->length)
+ add_stmt_with_node_force (pa->length, gnat_node);
+ }
+
+ add_stmt (gnu_result);
+ gnu_result = end_stmt_group ();
+ }
+
/* If we are dealing with a return from an Ada procedure with parameters
passed by copy-in/copy-out, we need to return a record containing the
final values of these parameters. If the list contains only one entry,
@@ -2637,31 +2662,6 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
VEC_pop (tree, gnu_return_label_stack);
- /* If we populated the parameter attributes cache, we need to make sure that
- the cached expressions are evaluated on all the possible paths leading to
- their uses. So we force their evaluation on entry of the function. */
- cache = DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language->parm_attr_cache;
- if (cache)
- {
- struct parm_attr_d *pa;
- int i;
-
- start_stmt_group ();
-
- FOR_EACH_VEC_ELT (parm_attr, cache, i, pa)
- {
- if (pa->first)
- add_stmt_with_node_force (pa->first, gnat_node);
- if (pa->last)
- add_stmt_with_node_force (pa->last, gnat_node);
- if (pa->length)
- add_stmt_with_node_force (pa->length, gnat_node);
- }
-
- add_stmt (gnu_result);
- gnu_result = end_stmt_group ();
- }
-
end_subprog_body (gnu_result);
/* Attempt setting the end_locus of our GCC body tree, typically a