Commit 42f6e2ec by Richard Guenther Committed by Richard Biener

re PR middle-end/32493 (Fails to inline varargs function with unused arguments)

2006-06-29  Richard Guenther  <rguenther@suse.de>

	PR middle-end/32493
	* gimplify.c (gimplify_call_expr): Ignore variable argument parts
	during type verification.

	* gcc.dg/inline-23.c: New testcase.

From-SVN: r126113
parent 29fbecf3
2006-06-29 Richard Guenther <rguenther@suse.de>
PR middle-end/32493
* gimplify.c (gimplify_call_expr): Ignore variable argument parts
during type verification.
2007-06-29 Jan Hubicka <jh@suse.cz> 2007-06-29 Jan Hubicka <jh@suse.cz>
* recog.c (validate_change_rtx_1): Unshare TO argument. * recog.c (validate_change_rtx_1): Unshare TO argument.
......
...@@ -2138,15 +2138,22 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value) ...@@ -2138,15 +2138,22 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
if (parms) if (parms)
{ {
for (i = 0, p = parms; i < nargs; i++, p = TREE_CHAIN (p)) for (i = 0, p = parms; i < nargs; i++, p = TREE_CHAIN (p))
if (!p {
|| TREE_VALUE (p) == error_mark_node /* If this is a varargs function defer inlining decision
to callee. */
if (!p)
break;
if (TREE_VALUE (p) == error_mark_node
|| CALL_EXPR_ARG (*expr_p, i) == error_mark_node || CALL_EXPR_ARG (*expr_p, i) == error_mark_node
|| !fold_convertible_p (TREE_VALUE (p), CALL_EXPR_ARG (*expr_p, i))) || TREE_CODE (TREE_VALUE (p)) == VOID_TYPE
|| !fold_convertible_p (TREE_VALUE (p),
CALL_EXPR_ARG (*expr_p, i)))
{ {
CALL_CANNOT_INLINE_P (*expr_p) = 1; CALL_CANNOT_INLINE_P (*expr_p) = 1;
break; break;
} }
} }
}
else if (decl && DECL_ARGUMENTS (decl)) else if (decl && DECL_ARGUMENTS (decl))
{ {
for (i = 0, p = DECL_ARGUMENTS (decl); i < nargs; for (i = 0, p = DECL_ARGUMENTS (decl); i < nargs;
......
2006-06-29 Richard Guenther <rguenther@suse.de>
PR middle-end/32493
* gcc.dg/inline-23.c: New testcase.
2007-06-29 Uros Bizjak <ubizjak@gmail.com> 2007-06-29 Uros Bizjak <ubizjak@gmail.com>
PR tree-optimization/24659 PR tree-optimization/24659
/* { dg-do compile } */
/* { dg-options "-std=gnu89" } */
/* Make sure we can inline a varargs function whose variable arguments
are not used. See PR32493. */
static inline __attribute__((always_inline)) void __check_printsym_format(const
char *fmt, ...)
{
}
static inline __attribute__((always_inline)) void print_symbol(const char *fmt,
unsigned long addr)
{
__check_printsym_format(fmt, "");
}
void do_initcalls(void **call)
{
print_symbol(": %s()", (unsigned long) *call);
}
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