aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2017-07-16 13:36:27 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2017-07-16 13:36:27 +0000
commit519087cf749bd002784f09f0ca6f74215fbf5bbc (patch)
tree340c54dbda6a6049126064171881c3bc6d78bc4c /gcc
parente1813e4b85ca24a49caa3d80cea025dd172ff770 (diff)
downloadgcc-519087cf749bd002784f09f0ca6f74215fbf5bbc.zip
gcc-519087cf749bd002784f09f0ca6f74215fbf5bbc.tar.gz
gcc-519087cf749bd002784f09f0ca6f74215fbf5bbc.tar.bz2
gimplify.c (mostly_copy_tree_r): Revert latest change.
* gimplify.c (mostly_copy_tree_r): Revert latest change. (gimplify_save_expr): Likewise. From-SVN: r250238
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gimplify.c24
2 files changed, 24 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ff249f1..4d04f54 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-07-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gimplify.c (mostly_copy_tree_r): Revert latest change.
+ (gimplify_save_expr): Likewise.
+
2017-07-07 Jan Hubicka <hubicka@ucw.cz>
* ipa-visibility.c (function_and_variable_visibility): Fix pasto.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index d456c3e..641a821 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -818,7 +818,12 @@ mostly_copy_tree_r (tree *tp, int *walk_subtrees, void *data)
/* Stop at types, decls, constants like copy_tree_r. */
else if (TREE_CODE_CLASS (code) == tcc_type
|| TREE_CODE_CLASS (code) == tcc_declaration
- || TREE_CODE_CLASS (code) == tcc_constant)
+ || TREE_CODE_CLASS (code) == tcc_constant
+ /* We can't do anything sensible with a BLOCK used as an
+ expression, but we also can't just die when we see it
+ because of non-expression uses. So we avert our eyes
+ and cross our fingers. Silly Java. */
+ || code == BLOCK)
*walk_subtrees = 0;
/* Cope with the statement expression extension. */
@@ -5802,10 +5807,19 @@ gimplify_save_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
/* If the SAVE_EXPR has not been resolved, then evaluate it once. */
if (!SAVE_EXPR_RESOLVED_P (*expr_p))
{
- gcc_assert (TREE_TYPE (val) != void_type_node);
- /* The temporary may not be an SSA name as later abnormal and EH
- control flow may invalidate use/def domination. */
- val = get_initialized_tmp_var (val, pre_p, post_p, false);
+ /* The operand may be a void-valued expression such as SAVE_EXPRs
+ generated by the Java frontend for class initialization. It is
+ being executed only for its side-effects. */
+ if (TREE_TYPE (val) == void_type_node)
+ {
+ ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
+ is_gimple_stmt, fb_none);
+ val = NULL;
+ }
+ else
+ /* The temporary may not be an SSA name as later abnormal and EH
+ control flow may invalidate use/def domination. */
+ val = get_initialized_tmp_var (val, pre_p, post_p, false);
TREE_OPERAND (*expr_p, 0) = val;
SAVE_EXPR_RESOLVED_P (*expr_p) = 1;