aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2010-04-15 10:17:54 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2010-04-15 10:17:54 +0000
commit932c865054836d348e629f70d71a07b2ab4ea607 (patch)
treeaa826ca1631bf85a3d9e79762dc859d1c01d5c29 /gcc
parent8ff6c6640bcff32c26f5a09e33ad61df15c96c55 (diff)
downloadgcc-932c865054836d348e629f70d71a07b2ab4ea607.zip
gcc-932c865054836d348e629f70d71a07b2ab4ea607.tar.gz
gcc-932c865054836d348e629f70d71a07b2ab4ea607.tar.bz2
trans.c (call_to_gnu): Do not unnecessarily force side-effects of actual parameters before the call.
* gcc-interface/trans.c (call_to_gnu): Do not unnecessarily force side-effects of actual parameters before the call. From-SVN: r158369
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/trans.c18
2 files changed, 11 insertions, 12 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 008924c..3796319 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
2010-04-15 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interface/trans.c (call_to_gnu): Do not unnecessarily force
+ side-effects of actual parameters before the call.
+
+2010-04-15 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/decl.c (validate_size): Reorder, remove obsolete test
and warning.
(set_rm_size): Reorder and remove obsolete test.
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index ec2b8ca..adaa7ee 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -2778,7 +2778,12 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
gnu_name_list = tree_cons (NULL_TREE, gnu_name, gnu_name_list);
if (!(gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL))
- continue;
+ {
+ /* Make sure side-effects are evaluated before the call. */
+ if (TREE_SIDE_EFFECTS (gnu_name))
+ append_to_statement_list (gnu_name, &gnu_before_list);
+ continue;
+ }
/* If this is 'Null_Parameter, pass a zero even though we are
dereferencing it. */
@@ -2849,22 +2854,11 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
if (length > 1)
{
- tree gnu_name;
-
/* The call sequence must contain one and only one call, even though
the function is const or pure. So force a SAVE_EXPR. */
gnu_call = build1 (SAVE_EXPR, TREE_TYPE (gnu_call), gnu_call);
TREE_SIDE_EFFECTS (gnu_call) = 1;
gnu_name_list = nreverse (gnu_name_list);
-
- /* If any of the names had side-effects, ensure they are all
- evaluated before the call. */
- for (gnu_name = gnu_name_list;
- gnu_name;
- gnu_name = TREE_CHAIN (gnu_name))
- if (TREE_SIDE_EFFECTS (TREE_VALUE (gnu_name)))
- append_to_statement_list (TREE_VALUE (gnu_name),
- &gnu_before_list);
}
if (Nkind (Name (gnat_node)) == N_Explicit_Dereference)