From: Richard Biener Date: Tue, 20 Sep 2016 12:20:37 +0000 (+0000) Subject: re PR tree-optimization/77646 (GCC Segfault with -O3) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b5bbe47bb37addb3c5b6c6065a28fa44953ed351;p=gcc.git re PR tree-optimization/77646 (GCC Segfault with -O3) 2016-09-20 Richard Biener PR tree-optimization/77646 * tree-ssa-sccvn.c (visit_reference_op_call): Always value-number a VDEF. * gcc.dg/torture/pr77646.c: New testcase. From-SVN: r240261 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cef1504d962..7ab0b82009e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-09-20 Richard Biener + + PR tree-optimization/77646 + * tree-ssa-sccvn.c (visit_reference_op_call): Always value-number + a VDEF. + 2016-09-20 Tamar Christina * config/aarch64/arm_neon.h: Add gnu_inline and artificial diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ca54995cc6a..9588beddba0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-09-20 Richard Biener + + PR tree-optimization/77646 + * gcc.dg/torture/pr77646.c: New testcase. + 2016-09-19 Bernd Edlinger PR c++/77434 diff --git a/gcc/testsuite/gcc.dg/torture/pr77646.c b/gcc/testsuite/gcc.dg/torture/pr77646.c new file mode 100644 index 00000000000..1b1990037bf --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr77646.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +struct e { + int (*f)(); + void (*g)(); +} * c; +int a; +void *h(); +typedef struct { struct e j; } k; +int l() { return a; } +const struct e b = {l}; +void m() +{ + k *d = h(); + d->j = b; + c = (struct e *)d; + struct e *i = c; + if (i->f(c)) + while (i->f(c)) + i->g(); +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index e120b4f72dc..bf5e97ae2f0 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -3470,6 +3470,10 @@ visit_reference_op_call (tree lhs, gcall *stmt) { if (vnresult->result_vdef && vdef) changed |= set_ssa_val_to (vdef, vnresult->result_vdef); + else if (vdef) + /* If the call was discovered to be pure or const reflect + that as far as possible. */ + changed |= set_ssa_val_to (vdef, vuse_ssa_val (gimple_vuse (stmt))); if (!vnresult->result && lhs) vnresult->result = lhs;