aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-04-04 11:52:35 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-04-04 11:52:35 +0000
commit45b6259486e4a1201c630186338e0845ffeab2f5 (patch)
tree5d195f2c96f8f418bd1d795709474cd7c6d0007d /gcc/gimplify.c
parentbb609c35be50a8b8a89005d1f5f4896a29c4ffae (diff)
downloadgcc-45b6259486e4a1201c630186338e0845ffeab2f5.zip
gcc-45b6259486e4a1201c630186338e0845ffeab2f5.tar.gz
gcc-45b6259486e4a1201c630186338e0845ffeab2f5.tar.bz2
re PR middle-end/60746 (ICE segfault in gimple-expr.c:314)
2014-04-04 Richard Biener <rguenther@suse.de> PR ipa/60746 * tree-ssanames.c (make_ssa_name_fn): Fix assert. * gimple.c (gimple_set_bb): Avoid ICEing for NULL cfun for non-GIMPLE_LABELs. * gimplify.h (gimple_add_tmp_var_fn): Declare. * gimplify.c (gimple_add_tmp_var_fn): New function. * gimple-expr.h (create_tmp_reg_fn): Declare. * gimple-expr.c (create_tmp_reg_fn): New function. * gimple-low.c (record_vars_into): Don't change cfun. * cgraph.c (cgraph_redirect_edge_call_stmt_to_callee): Fix code generation without cfun. * g++.dg/torture/pr60746.C: New testcase. From-SVN: r209079
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index ad2178d..7441784 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -627,6 +627,25 @@ force_constant_size (tree var)
/* Push the temporary variable TMP into the current binding. */
void
+gimple_add_tmp_var_fn (struct function *fn, tree tmp)
+{
+ gcc_assert (!DECL_CHAIN (tmp) && !DECL_SEEN_IN_BIND_EXPR_P (tmp));
+
+ /* Later processing assumes that the object size is constant, which might
+ not be true at this point. Force the use of a constant upper bound in
+ this case. */
+ if (!tree_fits_uhwi_p (DECL_SIZE_UNIT (tmp)))
+ force_constant_size (tmp);
+
+ DECL_CONTEXT (tmp) = fn->decl;
+ DECL_SEEN_IN_BIND_EXPR_P (tmp) = 1;
+
+ record_vars_into (tmp, fn->decl);
+}
+
+/* Push the temporary variable TMP into the current binding. */
+
+void
gimple_add_tmp_var (tree tmp)
{
gcc_assert (!DECL_CHAIN (tmp) && !DECL_SEEN_IN_BIND_EXPR_P (tmp));