diff options
author | Alexandre Petit-Bianco <apbianco@redhat.com> | 2001-06-05 08:48:58 -0700 |
---|---|---|
committer | Alexandre Petit-Bianco <apbianco@gcc.gnu.org> | 2001-06-05 08:48:58 -0700 |
commit | 0c90837b164f284ac805b4db325080261457b24a (patch) | |
tree | c510c5ae08cb32951c451bef9b4102d7d25fbe67 | |
parent | 7f471801f0e1f0c7befbc6cc9377642d7e3a8ac6 (diff) | |
download | gcc-0c90837b164f284ac805b4db325080261457b24a.zip gcc-0c90837b164f284ac805b4db325080261457b24a.tar.gz gcc-0c90837b164f284ac805b4db325080261457b24a.tar.bz2 |
expr.c (force_evaluation_order): Match wrapped ctor calls, locate arguments accordingly.
2001-06-04 Alexandre Petit-Bianco <apbianco@redhat.com>
* expr.c (force_evaluation_order): Match wrapped ctor calls, locate
arguments accordingly.
(http://gcc.gnu.org/ml/gcc-patches/2001-06/msg00214.html)
From-SVN: r42910
-rw-r--r-- | gcc/java/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/java/expr.c | 21 |
2 files changed, 23 insertions, 3 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 1ae6b50..39bd011 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2001-06-04 Alexandre Petit-Bianco <apbianco@redhat.com> + + * expr.c (force_evaluation_order): Match wrapped ctor calls, locate + arguments accordingly. + 2001-06-02 Joseph S. Myers <jsm28@cam.ac.uk> * gcj.texi: Move contents to just after title page. diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 9ba0739..e9af7fc 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -3263,16 +3263,31 @@ force_evaluation_order (node) if (TREE_SIDE_EFFECTS (TREE_OPERAND (node, 1))) TREE_OPERAND (node, 0) = save_expr (TREE_OPERAND (node, 0)); } - else if (TREE_CODE (node) == CALL_EXPR || TREE_CODE (node) == NEW_CLASS_EXPR) + else if (TREE_CODE (node) == CALL_EXPR + || TREE_CODE (node) == NEW_CLASS_EXPR + || (TREE_CODE (node) == COMPOUND_EXPR + && TREE_CODE (TREE_OPERAND (node, 0)) == CALL_EXPR + && TREE_CODE (TREE_OPERAND (node, 1)) == SAVE_EXPR)) { tree arg, cmp; if (!TREE_OPERAND (node, 1)) return node; + arg = node; + + /* Position arg properly, account for wrapped around ctors. */ + if (TREE_CODE (node) == COMPOUND_EXPR) + arg = TREE_OPERAND (node, 0); + + arg = TREE_OPERAND (arg, 1); + + /* Not having a list of argument here is an error. */ + if (TREE_CODE (arg) != TREE_LIST) + abort (); + /* This reverses the evaluation order. This is a desired effect. */ - for (cmp = NULL_TREE, arg = TREE_OPERAND (node, 1); - arg; arg = TREE_CHAIN (arg)) + for (cmp = NULL_TREE; arg; arg = TREE_CHAIN (arg)) { tree saved = save_expr (force_evaluation_order (TREE_VALUE (arg))); cmp = (cmp == NULL_TREE ? saved : |