diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-06 11:23:59 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-06 11:23:59 +0000 |
commit | 11582f4e8968ad4f3d776027a4ac34127b58d7a0 (patch) | |
tree | f38d084dfce120ac3285b6703630b8c744802276 /gcc/gimplify.c | |
parent | 0ef89dfdc208f14d10e19a0d9e3aad04f879bc0a (diff) | |
download | gcc-11582f4e8968ad4f3d776027a4ac34127b58d7a0.tar.gz |
2007-07-06 Richard Guenther <rguenther@suse.de>
* gimplify.c (gimplify_call_expr): Prefer DECL_ARGUMENTS over
TYPE_ARG_TYPES for verification of argument types. Use
DECL_ARG_TYPE instead of the PARM_DECL type. Take excess
parameters as variable arguments.
* g++.dg/opt/pr30965.C: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126412 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 5510f6008db..dd3d5fa5aba 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2135,7 +2135,27 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value) /* Verify if the type of the argument matches that of the function declaration. If we cannot verify this or there is a mismatch, mark the call expression so it doesn't get inlined later. */ - if (parms) + if (decl && DECL_ARGUMENTS (decl)) + { + for (i = 0, p = DECL_ARGUMENTS (decl); i < nargs; + i++, p = TREE_CHAIN (p)) + { + /* We cannot distinguish a varargs function from the case + of excess parameters, still defering the inlining decision + to the callee is possible. */ + if (!p) + break; + if (p == error_mark_node + || CALL_EXPR_ARG (*expr_p, i) == error_mark_node + || !fold_convertible_p (DECL_ARG_TYPE (p), + CALL_EXPR_ARG (*expr_p, i))) + { + CALL_CANNOT_INLINE_P (*expr_p) = 1; + break; + } + } + } + else if (parms) { for (i = 0, p = parms; i < nargs; i++, p = TREE_CHAIN (p)) { @@ -2154,19 +2174,6 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value) } } } - else if (decl && DECL_ARGUMENTS (decl)) - { - for (i = 0, p = DECL_ARGUMENTS (decl); i < nargs; - i++, p = TREE_CHAIN (p)) - if (!p - || p == error_mark_node - || CALL_EXPR_ARG (*expr_p, i) == error_mark_node - || !fold_convertible_p (TREE_TYPE (p), CALL_EXPR_ARG (*expr_p, i))) - { - CALL_CANNOT_INLINE_P (*expr_p) = 1; - break; - } - } else if (nargs != 0) CALL_CANNOT_INLINE_P (*expr_p) = 1; |