https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77768
--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> --- Author: rguenth Date: Thu Nov 3 13:25:51 2016 New Revision: 241818 URL: https://gcc.gnu.org/viewcvs?rev=241818&root=gcc&view=rev Log: 2016-11-03 Richard Biener <rguent...@suse.de> Backport from mainline 2016-09-29 Richard Biener <rguent...@suse.de> PR tree-optimization/77768 * tree-ssa-sccvn.c (visit_reference_op_store): Properly deal with stores to a place we know has a constant value. * tree-vrp.c (set_defs_to_varying): New helper avoiding writing to vr_const_varying. (vrp_initialize): Call it. (vrp_visit_stmt): Likewise. (evrp_dom_walker::before_dom_children): Likewise. * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): Handle stores to readonly memory when removing redundant stores. * gcc.dg/torture/pr77768.c: New testcase. Added: branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr77768.c Modified: branches/gcc-6-branch/gcc/ChangeLog branches/gcc-6-branch/gcc/testsuite/ChangeLog branches/gcc-6-branch/gcc/tree-ssa-pre.c branches/gcc-6-branch/gcc/tree-ssa-sccvn.c branches/gcc-6-branch/gcc/tree-vrp.c