diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-02-13 22:28:03 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2006-02-13 22:28:03 +0100 |
commit | 6f538523d1e363cb51f08b52e31062304352e543 (patch) | |
tree | 1f4da557cb99e9845fb71b7c810d10b3f6f929cc /gcc/gimplify.c | |
parent | 2ed8d2241e1e3ba077fc6dc3813f202f45414fbe (diff) | |
download | gcc-6f538523d1e363cb51f08b52e31062304352e543.zip gcc-6f538523d1e363cb51f08b52e31062304352e543.tar.gz gcc-6f538523d1e363cb51f08b52e31062304352e543.tar.bz2 |
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
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 7105698..82e747f 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -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,19 +2025,22 @@ 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) { - tree fndecl = get_callee_fndecl (*expr_p); - tree arglist = TREE_OPERAND (*expr_p, 1); - tree new = fold_builtin (fndecl, arglist, !want_value); - - if (new && new != *expr_p) + decl = get_callee_fndecl (*expr_p); + if (decl && DECL_BUILT_IN (decl)) { - /* There was a transformation of this call which computes the - same value, but in a more efficient way. Return and try - again. */ - *expr_p = new; - return GS_OK; + tree arglist = TREE_OPERAND (*expr_p, 1); + tree new = fold_builtin (decl, arglist, !want_value); + + if (new && new != *expr_p) + { + /* There was a transformation of this call which computes the + same value, but in a more efficient way. Return and try + again. */ + *expr_p = new; + return GS_OK; + } } } |