diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cb2ec45280a..e7e3601058d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-01-13 Richard Biener + + PR tree-optimization/69242 + * tree-ssa-sccvn.c (visit_reference_op_load): Replace bogus + assert with a check. + 2016-01-13 Richard Biener PR tree-optimization/69186 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0ce47d49ea7..4568a636b62 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-01-13 Richard Biener + + PR tree-optimization/69242 + * gcc.dg/torture/pr69242.c: New testcase. + 2016-01-13 Richard Biener PR tree-optimization/69186 diff --git a/gcc/testsuite/gcc.dg/torture/pr69242.c b/gcc/testsuite/gcc.dg/torture/pr69242.c new file mode 100644 index 00000000000..d7f171810b9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr69242.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-w" } */ + +int a[1]; +void *memcpy(); +int smx_ctx_base_factory_create_context_sized(); +void getcontext(); +void smx_ctx_sysv_create_context() { + int *b = (int *)smx_ctx_base_factory_create_context_sized(); + getcontext(); + memcpy(a, &b, sizeof(int)); + switch (a[0]) + ; +} + diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index f231ebefbaa..669d0b1e8a0 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -3221,8 +3221,11 @@ visit_reference_op_load (tree lhs, tree op, gimple *stmt) gimple_seq stmts = NULL; result = maybe_push_res_to_seq (rcode, TREE_TYPE (op), ops, &stmts); - gcc_assert (result && gimple_seq_singleton_p (stmts)); - new_stmt = gimple_seq_first_stmt (stmts); + if (result) + { + gcc_assert (gimple_seq_singleton_p (stmts)); + new_stmt = gimple_seq_first_stmt (stmts); + } } else /* The expression is already available. */