aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2007-02-16 03:38:22 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2007-02-16 03:38:22 +0000
commit939409afced0a24eb36b7bda1d98244f8a18e65d (patch)
treeab46b6fc569996fc94b0894059374459f6e9ad7f /gcc/tree.c
parent3c32c87f609a47e126044ce2d3f29701fa2c4dcc (diff)
downloadgcc-939409afced0a24eb36b7bda1d98244f8a18e65d.zip
gcc-939409afced0a24eb36b7bda1d98244f8a18e65d.tar.gz
gcc-939409afced0a24eb36b7bda1d98244f8a18e65d.tar.bz2
re PR middle-end/30391 (ICE at -O1 with conditional expressions and GIMPLE_MODIFY_STMT)
PR middle-end/30391 * tree.c (expr_align): Handle MODIFY_EXPR. GIMPLE_MODIFY_STMT should be unreachable. (build2_stat): Allow construction of MODIFY_EXPR at any time. For the time being redirect GIMPLE_MODIFY_STMT to the new (renamed) build_gimple_modify_stmt_stat. (build2_gimple_stat): Rename to... (build_gimple_modify_stmt_stat): Now longer take a CODE argument. Always build a GIMPLE_MODIFY_STMT node. * tree.h (build2_gimple, build2_gimple_stat): Delete. (build_gimple_modify_stmt, build_gimple_modify_stmt_stat): New declarations. * tree-cfg.c (factor_computed_gotos, tree_merge_blocks, gimplify_val): Use build_gimple_modify_stmt instead of build2_gimple. * tree-complex.c (set_component_ssa_name, expand_complex_move, expand_complex_div_wide): Likewise. * tree-ssa-dom.c (record_equivalences_from_stmt): Likewise. * tree-ssa-loop-im.c (schedule_sm): Likewise. * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Likewise. * tree-ssa-loop-manip.c (create_iv): Likewise. * tree-ssa-phiopt.c (conditional_replacement, minmax_replacement, abs_replacement): Likewise. * tree-ssa-pre.c (create_expression_by_pieces, poolify_modify_stmt, realify_fake_stores): Likewise. * builtins.c (std_expand_builtin_va_start): Build a MODIFY_EXPR node rather than a GIMPLE_MODIFY_STMT node. (std_gimpify_va_arg_expr, expand_builtin_va_copy, fold_builtin_memset, fold_builtin_memory_op, do_mpfr_sincos): Likewise. (integer_valued_real_p): Handle MODIFY_EXPR, not GIMPLE_MODIFY_STMT. * expr.c (expand_expr_real_1): Handle both MODIFY_EXPR and GIMPLE_MODIFY_STMT. * gfortran.dg/pr30391-1.f90: New test case. From-SVN: r122030
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c48
1 files changed, 15 insertions, 33 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 842e1d0..d9982e8 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1896,14 +1896,11 @@ expr_align (tree t)
align1 = TYPE_ALIGN (TREE_TYPE (t));
return MAX (align0, align1);
- case MODIFY_EXPR:
- /* FIXME tuples: It is unclear to me if this function, which
- is only called from ADA, is called on gimple or non gimple
- trees. Let's assume it's from gimple trees unless we hit
- this abort. */
+ case GIMPLE_MODIFY_STMT:
+ /* We should never ask for the alignment of a gimple statement. */
gcc_unreachable ();
- case SAVE_EXPR: case COMPOUND_EXPR: case GIMPLE_MODIFY_STMT:
+ case SAVE_EXPR: case COMPOUND_EXPR: case MODIFY_EXPR:
case INIT_EXPR: case TARGET_EXPR: case WITH_CLEANUP_EXPR:
case CLEANUP_POINT_EXPR:
/* These don't change the alignment of an object. */
@@ -3062,16 +3059,14 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
gcc_assert (TREE_CODE_LENGTH (code) == 2);
- if (code == MODIFY_EXPR && cfun && cfun->gimplified)
- {
- /* We should be talking GIMPLE_MODIFY_STMT by now. */
- gcc_unreachable ();
- }
-
- /* FIXME tuples: For now let's be lazy; later we must rewrite all
- build2 calls to build2_gimple calls. */
- if (TREE_CODE_CLASS (code) == tcc_gimple_stmt)
- return build2_gimple (code, arg0, arg1);
+#if 1
+ /* FIXME tuples: Statement's aren't expressions! */
+ if (code == GIMPLE_MODIFY_STMT)
+ return build_gimple_modify_stmt_stat (arg0, arg1 PASS_MEM_STAT);
+#else
+ /* Must use build_gimple_modify_stmt to construct GIMPLE_MODIFY_STMTs. */
+ gcc_assert (code != GIMPLE_MODIFY_STMT);
+#endif
t = make_node_stat (code PASS_MEM_STAT);
TREE_TYPE (t) = tt;
@@ -3104,31 +3099,18 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
}
-/* Similar as build2_stat, but for GIMPLE tuples. For convenience's sake,
- arguments and return type are trees. */
+/* Build a GIMPLE_MODIFY_STMT node. This tree code doesn't have a
+ type, so we can't use build2 (a.k.a. build2_stat). */
tree
-build2_gimple_stat (enum tree_code code, tree arg0, tree arg1 MEM_STAT_DECL)
+build_gimple_modify_stmt_stat (tree arg0, tree arg1 MEM_STAT_DECL)
{
- bool side_effects;
tree t;
- gcc_assert (TREE_CODE_LENGTH (code) == 2);
-
- t = make_node_stat (code PASS_MEM_STAT);
-
- side_effects = TREE_SIDE_EFFECTS (t);
-
+ t = make_node_stat (GIMPLE_MODIFY_STMT PASS_MEM_STAT);
/* ?? We don't care about setting flags for tuples... */
GIMPLE_STMT_OPERAND (t, 0) = arg0;
GIMPLE_STMT_OPERAND (t, 1) = arg1;
-
- /* ...except perhaps side_effects and volatility. ?? */
- TREE_SIDE_EFFECTS (t) = side_effects;
- TREE_THIS_VOLATILE (t) = (TREE_CODE_CLASS (code) == tcc_reference
- && arg0 && TREE_THIS_VOLATILE (arg0));
-
-
return t;
}