* gimple-fold.c (gimplify_and_update_call_from_tree): Add
vdef also to non-pure/const call stmts in the sequence.
* gcc.dg/pr52318.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184428
138bc75d-0d04-0410-961f-
82ee72b054a4
+2012-02-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/52318
+ * gimple-fold.c (gimplify_and_update_call_from_tree): Add
+ vdef also to non-pure/const call stmts in the sequence.
+
2012-02-20 David S. Miller <davem@davemloft.net>
* config/sparc/sparc.md (load_pcrel_sym<P:mode>): Explain why we
/* Statement simplification on GIMPLE.
- Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc.
Split out from tree-ssa-ccp.c.
This file is part of GCC.
for (i = gsi_last (stmts); !gsi_end_p (i); gsi_prev (&i))
{
new_stmt = gsi_stmt (i);
- if (gimple_assign_single_p (new_stmt)
- && !is_gimple_reg (gimple_assign_lhs (new_stmt)))
+ if ((gimple_assign_single_p (new_stmt)
+ && !is_gimple_reg (gimple_assign_lhs (new_stmt)))
+ || (is_gimple_call (new_stmt)
+ && (gimple_call_flags (new_stmt)
+ & (ECF_NOVOPS | ECF_PURE | ECF_CONST | ECF_NORETURN)) == 0))
{
tree vdef;
if (!laststore)
+2012-02-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/52318
+ * gcc.dg/pr52318.c: New test.
+
2012-02-20 Kai Tietz <ktietz@redhat.com>
* gcc.dg/bf-ms-layout-3.c: New testcase.
--- /dev/null
+/* PR tree-optimization/52318 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -ftracer -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dce" } */
+
+int c;
+char *p;
+
+void
+foo (int i)
+{
+ char a[2];
+ char b[20];
+ p = __builtin___stpcpy_chk (a, "", 2);
+ p = __builtin___stpcpy_chk (&b[16], i ? "e" : "jkl", 4);
+ if (c)
+ foo (i);
+}