re PR tree-optimization/37433 (tree check: expected function_decl, have string_cst in ccp_fold, at tree-ssa-ccp.c:1050)

2008-09-09  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/37433
	* tree-ssa-ccp.c (ccp_fold): Properly guard folding of
	function calls.

	* gcc.c-torture/compile/pr37433.c: New testcase.

From-SVN: r140143
This commit is contained in:
Richard Guenther 2008-09-09 10:06:54 +00:00 committed by Richard Biener
parent 6e548df501
commit a135b1c41c
4 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2008-09-09 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37433
* tree-ssa-ccp.c (ccp_fold): Properly guard folding of
function calls.
2008-09-09 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37387

View File

@ -1,3 +1,8 @@
2008-09-09 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37433
* gcc.c-torture/compile/pr37433.c: New testcase.
2008-09-09 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37387

View File

@ -0,0 +1,11 @@
int regex_subst(void)
{
const void *subst = "";
return (*(int (*)(int))subst) (0);
}
int foobar (void)
{
int x;
return (*(int (*)(void))&x) ();
}

View File

@ -1047,6 +1047,7 @@ ccp_fold (gimple stmt)
fn = val->value;
}
if (TREE_CODE (fn) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL
&& DECL_BUILT_IN (TREE_OPERAND (fn, 0)))
{
tree *args = XALLOCAVEC (tree, gimple_call_num_args (stmt));