aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEaswaran Raman <eraman@gcc.gnu.org>2013-05-21 22:36:29 +0000
committerEaswaran Raman <eraman@gcc.gnu.org>2013-05-21 22:36:29 +0000
commit4f7a634e7be19d39eca72e0c8e30e52c9e48f3f0 (patch)
treefc587480adf7a3b1be4776a2f69bd71d81958cfb
parent639879525eb8bbff721b1accf297de423ceb40a1 (diff)
downloadgcc-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
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/reassoc-29.c15
-rw-r--r--gcc/tree-ssa-reassoc.c6
4 files changed, 33 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 57f260d4..0dcb69c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2013-05-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/57331
@@ -46,6 +52,7 @@
* config/sh/sh.md (fmasf4): Remove empty constraints strings.
(*fmasf4, *fmasf4_media): New insns.
+>>>>>>> .r199151
2013-05-19 Richard Sandiford <rdsandiford@googlemail.com>
* config/mips/mips.h (BASE_INSN_LENGTH, NOP_INSN_LENGTH): New macros.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7bfe507..93d9668 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-21 Easwaran Raman <eraman@google.com>
+
+ PR tree-optimization/57322
+ * gcc.dg/tree-ssa/reassoc-29.c: New testcase.
+
2013-05-21 Graham Stott <graham.stott@btinternet.com>
* lib/scanasm.exp (dg-function-on-line): Make MIPS targets match
@@ -105,7 +110,7 @@
PR c++/57175
* g++.dg/pr57175.C: New testcase.
-2013-05-17 Easwaran Raman <eraman@google.com>
+2013-05-17 Easwaran Raman <eraman@google.com>
* gcc.dg/tree-ssa/reassoc-28.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-29.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-29.c
new file mode 100644
index 0000000..ac01d75
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-29.c
@@ -0,0 +1,15 @@
+/* PR tree-optimization/57322 */
+/* { dg-do compile } */
+/* { dg-options "-w -O1" } */
+int a;
+
+void f (void)
+{
+ char b;
+
+ for (;; a++)
+ {
+ char *p = &b, *q;
+ *q = b < 0 & !!*p;
+ }
+}
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))