Commit 6f538523 by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/26092 (ICE on const function pointer assigned to a builtin function)

	PR middle-end/26092
	* gimplify.c (gimplify_call_expr): Don't call get_callee_fndecl
	twice if decl is a builtin.  When trying again, call get_callee_fndecl
	first to verify it is still a builtin.

	* gcc.c-torture/compile/20060208-1.c: New test.

From-SVN: r110927
parent 2ed8d224
2006-02-13 Jakub Jelinek <jakub@redhat.com>
PR middle-end/26092
* gimplify.c (gimplify_call_expr): Don't call get_callee_fndecl
twice if decl is a builtin. When trying again, call get_callee_fndecl
first to verify it is still a builtin.
2006-02-13 Geoffrey Keating <geoffk@apple.com>
* dwarf2out.c (base_type_die): Don't add AT_name here.
......
......@@ -1970,9 +1970,8 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
decl = get_callee_fndecl (*expr_p);
if (decl && DECL_BUILT_IN (decl))
{
tree fndecl = get_callee_fndecl (*expr_p);
tree arglist = TREE_OPERAND (*expr_p, 1);
tree new = fold_builtin (fndecl, arglist, !want_value);
tree new = fold_builtin (decl, arglist, !want_value);
if (new && new != *expr_p)
{
......@@ -2026,11 +2025,13 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
TREE_OPERAND (*expr_p, 1) = nreverse (TREE_OPERAND (*expr_p, 1));
/* Try this again in case gimplification exposed something. */
if (ret != GS_ERROR && decl && DECL_BUILT_IN (decl))
if (ret != GS_ERROR)
{
decl = get_callee_fndecl (*expr_p);
if (decl && DECL_BUILT_IN (decl))
{
tree fndecl = get_callee_fndecl (*expr_p);
tree arglist = TREE_OPERAND (*expr_p, 1);
tree new = fold_builtin (fndecl, arglist, !want_value);
tree new = fold_builtin (decl, arglist, !want_value);
if (new && new != *expr_p)
{
......@@ -2041,6 +2042,7 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
return GS_OK;
}
}
}
/* If the function is "const" or "pure", then clear TREE_SIDE_EFFECTS on its
decl. This allows us to eliminate redundant or useless
......
2006-02-13 Jakub Jelinek <jakub@redhat.com>
PR middle-end/26092
* gcc.c-torture/compile/20060208-1.c: New test.
2006-02-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/26074
/* PR middle-end/26092 */
typedef __SIZE_TYPE__ size_t;
extern void *malloc (size_t);
void *(*const foo) (size_t) = malloc;
void *test (void)
{
return (*foo) (3);
}
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