Commit 06468254 by Richard Guenther Committed by Richard Biener

builtins.c (fold_builtin_1): Delete free (0).

2010-04-30  Richard Guenther  <rguenther@suse.de>

	* builtins.c (fold_builtin_1): Delete free (0).

	* gcc.dg/tree-ssa/builtin-free.c: New testcase.

From-SVN: r158923
parent 8cdea6ab
2010-04-30 Richard Guenther <rguenther@suse.de>
* builtins.c (fold_builtin_1): Delete free (0).
2010-04-29 Jan HUbicka <jh@suse.cz>
* gengtype.c (open_base_files): Add lto-streamer.h
......
......@@ -9817,7 +9817,6 @@ fold_builtin_1 (location_t loc, tree fndecl, tree arg0, bool ignore)
enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl);
switch (fcode)
{
case BUILT_IN_CONSTANT_P:
{
tree val = fold_builtin_constant_p (arg0);
......@@ -10199,6 +10198,11 @@ fold_builtin_1 (location_t loc, tree fndecl, tree arg0, bool ignore)
case BUILT_IN_VPRINTF:
return fold_builtin_printf (loc, fndecl, arg0, NULL_TREE, ignore, fcode);
case BUILT_IN_FREE:
if (integer_zerop (arg0))
return build_empty_stmt (loc);
break;
default:
break;
}
......
2010-04-30 Richard Guenther <rguenther@suse.de>
* gcc.dg/tree-ssa/builtin-free.c: New testcase.
2010-04-29 Fabien Chêne <fabien.chene@gmail.com>
PR c++/43890
......
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
void bar (void *);
void foo(unsigned n)
{
void *p = __builtin_malloc (n);
if (p)
{
bar (p);
__builtin_free (p);
p = 0;
}
__builtin_free (p);
}
/* We should remove the redundant call to free. */
/* { dg-final { scan-tree-dump-times "free" 1 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment