From 4f7a634e7be19d39eca72e0c8e30e52c9e48f3f0 Mon Sep 17 00:00:00 2001 From: Easwaran Raman Date: Tue, 21 May 2013 22:36:29 +0000 Subject: re PR tree-optimization/57322 (Segfault at -O1 in build_and_add_sum) 2013-05-21 Easwaran Raman PR tree-optimization/57322 * (build_and_add_sum): If a BB is empty, set the UID of the statement added to the BB to be 1. testsuite/ChangeLog: 2013-05-21 Easwaran Raman PR tree-optimization/57322 * gcc.dg/tree-ssa/reassoc-29.c: New testcase. From-SVN: r199165 --- gcc/tree-ssa-reassoc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gcc/tree-ssa-reassoc.c') diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 29c9dff..8e13763 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1165,8 +1165,12 @@ build_and_add_sum (tree type, tree op1, tree op2, enum tree_code opcode) if ((!op1def || gimple_nop_p (op1def)) && (!op2def || gimple_nop_p (op2def))) { + gimple first_stmt; + unsigned uid; gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR)); - gimple_set_uid (sum, gimple_uid (gsi_stmt (gsi))); + first_stmt = gsi_stmt (gsi); + uid = first_stmt ? gimple_uid (first_stmt) : 1; + gimple_set_uid (sum, uid); gsi_insert_before (&gsi, sum, GSI_NEW_STMT); } else if ((!op1def || gimple_nop_p (op1def)) -- cgit v1.1