diff options
author | Glen Nakamura <glen@imodulo.com> | 2002-11-21 21:42:40 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2002-11-21 21:42:40 +0000 |
commit | 1c83ea9fd0f1a301ec09499ae9d8bca527c41e6c (patch) | |
tree | 0e4821b66a41d5a3caf80bb79e99dcdf59d4d8b8 | |
parent | ff3afb56237e605084287f26b435bd5cc846c7e0 (diff) | |
download | gcc-1c83ea9fd0f1a301ec09499ae9d8bca527c41e6c.zip gcc-1c83ea9fd0f1a301ec09499ae9d8bca527c41e6c.tar.gz gcc-1c83ea9fd0f1a301ec09499ae9d8bca527c41e6c.tar.bz2 |
re PR c++/8342 (g++.jason/pmf7.C fails on i586-pc-linux-gnu)
PR c++/8342
* typeck.c (get_member_function_from_ptrfunc): Make sure that a
SAVE_EXPR for instance_ptr doesn't get evaluated first inside one
of the branches of a COND_EXPR.
From-SVN: r59360
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d370dbd..ca4839c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2002-11-21 Glen Nakamura <glen@imodulo.com> + + PR c++/8342 + * typeck.c (get_member_function_from_ptrfunc): Make sure that a + SAVE_EXPR for instance_ptr doesn't get evaluated first inside one + of the branches of a COND_EXPR. + 2002-11-19 Mark Mitchell <mark@codesourcery.com> * pt.c (for_each_template_parm): Free allocated memory. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 55b6dbd..c0e3fa6 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2541,6 +2541,7 @@ get_member_function_from_ptrfunc (instance_ptrptr, function) tree fntype = TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (function)); tree instance_ptr = *instance_ptrptr; + tree instance_save_expr = 0; if (instance_ptr == error_mark_node) { if (TREE_CODE (function) == PTRMEM_CST) @@ -2560,7 +2561,7 @@ get_member_function_from_ptrfunc (instance_ptrptr, function) } if (TREE_SIDE_EFFECTS (instance_ptr)) - instance_ptr = save_expr (instance_ptr); + instance_ptr = instance_save_expr = save_expr (instance_ptr); if (TREE_SIDE_EFFECTS (function)) function = save_expr (function); @@ -2621,9 +2622,9 @@ get_member_function_from_ptrfunc (instance_ptrptr, function) /* Make sure this doesn't get evaluated first inside one of the branches of the COND_EXPR. */ - if (TREE_CODE (instance_ptr) == SAVE_EXPR) + if (instance_save_expr) e1 = build (COMPOUND_EXPR, TREE_TYPE (e1), - instance_ptr, e1); + instance_save_expr, e1); function = e1; } |