diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-04 15:51:01 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-04 15:51:01 +0000 |
commit | 106213008af48c244bcbc3eb763dc67f4c0cf345 (patch) | |
tree | 3b703171163f9b0f85930ac0e96633ca603a07c5 /gcc/cp | |
parent | cf0c5d93479812d30f7e9a7d6697516422973771 (diff) | |
download | gcc-106213008af48c244bcbc3eb763dc67f4c0cf345.tar.gz |
PR c++/51253
PR c++/61382
gcc/
* gimplify.c (gimplify_arg): Non-static.
* gimplify.h: Declare it.
gcc/cp/
* cp-gimplify.c (cp_gimplify_expr): Handle CALL_EXPR_LIST_INIT_P here.
* semantics.c (simplify_aggr_init_expr): Not here, just copy it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211235 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/cp-gimplify.c | 21 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 15 |
3 files changed, 29 insertions, 14 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 334d6b1f3c4..6c501a8d0e2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2014-06-04 Jason Merrill <jason@redhat.com> + + PR c++/51253 + PR c++/61382 + * cp-gimplify.c (cp_gimplify_expr): Handle CALL_EXPR_LIST_INIT_P here. + * semantics.c (simplify_aggr_init_expr): Not here, just copy it. + 2014-06-04 Igor Zamyatin <igor.zamyatin@intel.com> PR c/58942 diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index ef4b04372bc..18142bf396e 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -723,6 +723,27 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) && !seen_error ()) return (enum gimplify_status) gimplify_cilk_spawn (expr_p); + /* DR 1030 says that we need to evaluate the elements of an + initializer-list in forward order even when it's used as arguments to + a constructor. So if the target wants to evaluate them in reverse + order and there's more than one argument other than 'this', gimplify + them in order. */ + ret = GS_OK; + if (PUSH_ARGS_REVERSED && CALL_EXPR_LIST_INIT_P (*expr_p) + && call_expr_nargs (*expr_p) > 2) + { + int nargs = call_expr_nargs (*expr_p); + location_t loc = EXPR_LOC_OR_LOC (*expr_p, input_location); + for (int i = 1; i < nargs; ++i) + { + enum gimplify_status t + = gimplify_arg (&CALL_EXPR_ARG (*expr_p, i), pre_p, loc); + if (t == GS_ERROR) + ret = GS_ERROR; + } + } + break; + default: ret = (enum gimplify_status) c_gimplify_expr (expr_p, pre_p, post_p); break; diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index c1c16f49f93..ca0c34bf6f2 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -3869,6 +3869,7 @@ simplify_aggr_init_expr (tree *tp) aggr_init_expr_nargs (aggr_init_expr), AGGR_INIT_EXPR_ARGP (aggr_init_expr)); TREE_NOTHROW (call_expr) = TREE_NOTHROW (aggr_init_expr); + CALL_EXPR_LIST_INIT_P (call_expr) = CALL_EXPR_LIST_INIT_P (aggr_init_expr); tree ret = call_expr; if (style == ctor) @@ -3900,20 +3901,6 @@ simplify_aggr_init_expr (tree *tp) ret = build2 (COMPOUND_EXPR, TREE_TYPE (slot), ret, slot); } - /* DR 1030 says that we need to evaluate the elements of an - initializer-list in forward order even when it's used as arguments to - a constructor. So if the target wants to evaluate them in reverse - order and there's more than one argument other than 'this', force - pre-evaluation. */ - if (PUSH_ARGS_REVERSED && CALL_EXPR_LIST_INIT_P (aggr_init_expr) - && aggr_init_expr_nargs (aggr_init_expr) > 2) - { - tree preinit; - stabilize_call (call_expr, &preinit); - if (preinit) - ret = build2 (COMPOUND_EXPR, TREE_TYPE (ret), preinit, ret); - } - if (AGGR_INIT_ZERO_FIRST (aggr_init_expr)) { tree init = build_zero_init (type, NULL_TREE, |