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
This commit is contained in:
Richard Guenther 2007-06-29 13:43:10 +00:00 committed by Richard Biener
parent 29fbecf33f
commit 42f6e2ec11
4 changed files with 42 additions and 7 deletions

View File

@ -1,3 +1,9 @@
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>
* recog.c (validate_change_rtx_1): Unshare TO argument.

View File

@ -2138,14 +2138,21 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
if (parms)
{
for (i = 0, p = parms; i < nargs; i++, p = TREE_CHAIN (p))
if (!p
|| TREE_VALUE (p) == error_mark_node
|| CALL_EXPR_ARG (*expr_p, i) == error_mark_node
|| !fold_convertible_p (TREE_VALUE (p), CALL_EXPR_ARG (*expr_p, i)))
{
CALL_CANNOT_INLINE_P (*expr_p) = 1;
{
/* 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
|| 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;
break;
}
}
}
else if (decl && DECL_ARGUMENTS (decl))
{

View File

@ -1,3 +1,8 @@
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>
PR tree-optimization/24659

View File

@ -0,0 +1,17 @@
/* { 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);
}