diff options
author | Richard Guenther <rguenther@suse.de> | 2011-10-13 12:07:44 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-10-13 12:07:44 +0000 |
commit | 2b3c0885d9baffc8a5c465fe94bbd25ce4e1ee6a (patch) | |
tree | 9fd933d033a83db660e820c57dd9f7e20bfb6a5f | |
parent | 4c8933bce93d7abff81a9b21ace228f62979d8aa (diff) | |
download | gcc-2b3c0885d9baffc8a5c465fe94bbd25ce4e1ee6a.zip gcc-2b3c0885d9baffc8a5c465fe94bbd25ce4e1ee6a.tar.gz gcc-2b3c0885d9baffc8a5c465fe94bbd25ce4e1ee6a.tar.bz2 |
re PR middle-end/50712 (invalid argument to gimple call)
2011-10-13 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50712
* ipa-split.c (split_function): Always re-gimplify parameters
when they are not gimple vals before passing them. Properly
check for type compatibility.
* gcc.target/i386/pr50712.c: New testcase.
From-SVN: r179919
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ipa-split.c | 24 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr50712.c | 33 |
4 files changed, 54 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fbf60be..6b0423a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-10-13 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/50712 + * ipa-split.c (split_function): Always re-gimplify parameters + when they are not gimple vals before passing them. Properly + check for type compatibility. + 2011-10-13 Tom de Vries <tom@codesourcery.com> * function.c (gimplify_parameters): Set number of arguments of call to diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index d1861e9..75cc619 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -958,7 +958,6 @@ split_function (struct split_point *split_point) tree retval = NULL, real_retval = NULL; bool split_part_return_p = false; gimple last_stmt = NULL; - bool conv_needed = false; unsigned int i; tree arg; @@ -1000,12 +999,8 @@ split_function (struct split_point *split_point) else arg = parm; - if (TYPE_MAIN_VARIANT (DECL_ARG_TYPE (parm)) - != TYPE_MAIN_VARIANT (TREE_TYPE (arg))) - { - conv_needed = true; - arg = fold_convert (DECL_ARG_TYPE (parm), arg); - } + if (!useless_type_conversion_p (DECL_ARG_TYPE (parm), TREE_TYPE (arg))) + arg = fold_convert (DECL_ARG_TYPE (parm), arg); VEC_safe_push (tree, heap, args_to_pass, arg); } @@ -1135,14 +1130,13 @@ split_function (struct split_point *split_point) /* Produce the call statement. */ gsi = gsi_last_bb (call_bb); - if (conv_needed) - FOR_EACH_VEC_ELT (tree, args_to_pass, i, arg) - if (!is_gimple_val (arg)) - { - arg = force_gimple_operand_gsi (&gsi, arg, true, NULL_TREE, - false, GSI_NEW_STMT); - VEC_replace (tree, args_to_pass, i, arg); - } + FOR_EACH_VEC_ELT (tree, args_to_pass, i, arg) + if (!is_gimple_val (arg)) + { + arg = force_gimple_operand_gsi (&gsi, arg, true, NULL_TREE, + false, GSI_NEW_STMT); + VEC_replace (tree, args_to_pass, i, arg); + } call = gimple_build_call_vec (node->decl, args_to_pass); gimple_set_block (call, DECL_INITIAL (current_function_decl)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 94faa47..ca2e33a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-10-13 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/50712 + * gcc.target/i386/pr50712.c: New testcase. + 2011-10-13 Tom de Vries <tom@codesourcery.com> * gcc.dg/memcpy-4.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr50712.c b/gcc/testsuite/gcc.target/i386/pr50712.c new file mode 100644 index 0000000..f08a944 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr50712.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-options "-O2" } */ + +typedef __builtin_va_list __va_list; +typedef __va_list __gnuc_va_list; +typedef __gnuc_va_list va_list; +struct MSVCRT__iobuf { }; +typedef struct MSVCRT__iobuf MSVCRT_FILE; +typedef union _printf_arg { } printf_arg; +MSVCRT_FILE MSVCRT__iob[20]; +int pf_print_a (va_list *); +int __attribute__((__cdecl__)) +MSVCRT_vfprintf_s(MSVCRT_FILE* file, const char *format, va_list valist) +{ + if(!((file != ((void *)0)) + || (MSVCRT__invalid_parameter(((void *)0), ((void *)0), + ((void *)0), 0, 0),0))) + return -1; + return pf_printf_a(&valist); +} +int __attribute__((__cdecl__)) +MSVCRT_vprintf_s(const char *format, va_list valist) +{ + return MSVCRT_vfprintf_s((MSVCRT__iob+1),format,valist); +} +int __attribute__((__cdecl__)) +MSVCRT_fprintf_s(MSVCRT_FILE* file, const char *format, ...) +{ + va_list valist; + va_start (valist, format); + return MSVCRT_vfprintf_s(file, format, valist); +} |