aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-09-27 16:19:57 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-09-27 16:19:57 +0200
commitb55c7343f02718bca7a8d2eba9dc9e6e3905d9e8 (patch)
treef1786b6bc23f822bbf3b6abba22114c8876894cf /gcc/gimplify.c
parent99124c31f9afaa8e713f3e1335d8e53c2ee61bc1 (diff)
downloadgcc-b55c7343f02718bca7a8d2eba9dc9e6e3905d9e8.zip
gcc-b55c7343f02718bca7a8d2eba9dc9e6e3905d9e8.tar.gz
gcc-b55c7343f02718bca7a8d2eba9dc9e6e3905d9e8.tar.bz2
re PR c++/82159 (ICE: in assign_temp, at function.c:961)
PR c++/82159 * gimplify.c (gimplify_modify_expr): Don't optimize away zero sized lhs from calls if the lhs has addressable type. * g++.dg/opt/pr82159.C: New test. From-SVN: r253230
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 8b29a71..c3fd6ac 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -5479,7 +5479,12 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
side as statements and throw away the assignment. Do this after
gimplify_modify_expr_rhs so we handle TARGET_EXPRs of addressable
types properly. */
- if (zero_sized_type (TREE_TYPE (*from_p)) && !want_value)
+ if (zero_sized_type (TREE_TYPE (*from_p))
+ && !want_value
+ /* Don't do this for calls that return addressable types, expand_call
+ relies on those having a lhs. */
+ && !(TREE_ADDRESSABLE (TREE_TYPE (*from_p))
+ && TREE_CODE (*from_p) == CALL_EXPR))
{
gimplify_stmt (from_p, pre_p);
gimplify_stmt (to_p, pre_p);