From 996e1de5e6bced0c6b6b0cbacee11ccc720ccdf4 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Thu, 8 Sep 2011 13:00:23 +0000 Subject: re PR tree-optimization/19831 (Missing DSE/malloc/free optimization) 2011-09-08 Richard Guenther PR tree-optimization/19831 * tree-ssa-dce.c (mark_all_reaching_defs_necessary_1): Also skip builtins with vdefs that do not really store something. (propagate_necessity): For calls to free that we can associate with an allocation function do not mark the freed pointer definition necessary. (eliminate_unnecessary_stmts): Remove a call to free if the associated call to an allocation function is not necessary. * gcc.dg/tree-ssa/pr19831-1.c: New testcase. * gcc.dg/tree-ssa/pr19831-2.c: Likewise. * gcc.dg/tree-ssa/pr19831-3.c: Likewise. * gcc.dg/errno-1.c: Adjust. From-SVN: r178687 --- gcc/testsuite/gcc.dg/errno-1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite/gcc.dg/errno-1.c') diff --git a/gcc/testsuite/gcc.dg/errno-1.c b/gcc/testsuite/gcc.dg/errno-1.c index d0365be..295deef 100644 --- a/gcc/testsuite/gcc.dg/errno-1.c +++ b/gcc/testsuite/gcc.dg/errno-1.c @@ -6,7 +6,7 @@ int main() { - void *p; + void * volatile p; errno = 0; p = malloc (-1); if (errno != 0) -- cgit v1.1