diff options
author | Easwaran Raman <eraman@gcc.gnu.org> | 2013-05-21 22:36:29 +0000 |
---|---|---|
committer | Easwaran Raman <eraman@gcc.gnu.org> | 2013-05-21 22:36:29 +0000 |
commit | 4f7a634e7be19d39eca72e0c8e30e52c9e48f3f0 (patch) | |
tree | fc587480adf7a3b1be4776a2f69bd71d81958cfb /gcc/tree-ssa-reassoc.c | |
parent | 639879525eb8bbff721b1accf297de423ceb40a1 (diff) | |
download | gcc-4f7a634e7be19d39eca72e0c8e30e52c9e48f3f0.zip gcc-4f7a634e7be19d39eca72e0c8e30e52c9e48f3f0.tar.gz gcc-4f7a634e7be19d39eca72e0c8e30e52c9e48f3f0.tar.bz2 |
re PR tree-optimization/57322 (Segfault at -O1 in build_and_add_sum)
2013-05-21 Easwaran Raman <eraman@google.com>
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 <eraman@google.com>
PR tree-optimization/57322
* gcc.dg/tree-ssa/reassoc-29.c: New testcase.
From-SVN: r199165
Diffstat (limited to 'gcc/tree-ssa-reassoc.c')
-rw-r--r-- | gcc/tree-ssa-reassoc.c | 6 |
1 files changed, 5 insertions, 1 deletions
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)) |