From db3ed0b3b72051c8b3f82f2f1228dfaad4fbce10 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 17 Mar 2011 16:21:39 +0100 Subject: [PATCH] re PR middle-end/48152 (Bootstrap failure for x86_64-w64-mingw32 due ICE) PR middle-end/48152 * var-tracking.c (prepare_call_arguments): If argument needs to be passed by reference, adjust argtype and mode. From-SVN: r171101 --- gcc/ChangeLog | 6 ++++++ gcc/var-tracking.c | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 298815dc353..694452e1d79 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-03-17 Jakub Jelinek + + PR middle-end/48152 + * var-tracking.c (prepare_call_arguments): If argument needs to be + passed by reference, adjust argtype and mode. + 2011-03-17 Richard Guenther PR middle-end/48134 diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 266f11fe46c..aab98331df3 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -5732,11 +5732,18 @@ prepare_call_arguments (basic_block bb, rtx insn) call_arguments = gen_rtx_EXPR_LIST (VOIDmode, item, call_arguments); if (t && t != void_list_node) { - enum machine_mode mode = TYPE_MODE (TREE_VALUE (t)); - rtx reg = targetm.calls.function_arg (&args_so_far, mode, - TREE_VALUE (t), true); - if (TREE_CODE (TREE_VALUE (t)) == REFERENCE_TYPE - && INTEGRAL_TYPE_P (TREE_TYPE (TREE_VALUE (t))) + tree argtype = TREE_VALUE (t); + enum machine_mode mode = TYPE_MODE (argtype); + rtx reg; + if (pass_by_reference (&args_so_far, mode, argtype, true)) + { + argtype = build_pointer_type (argtype); + mode = TYPE_MODE (argtype); + } + reg = targetm.calls.function_arg (&args_so_far, mode, + argtype, true); + if (TREE_CODE (argtype) == REFERENCE_TYPE + && INTEGRAL_TYPE_P (TREE_TYPE (argtype)) && reg && REG_P (reg) && GET_MODE (reg) == mode @@ -5747,7 +5754,7 @@ prepare_call_arguments (basic_block bb, rtx insn) && item) { enum machine_mode indmode - = TYPE_MODE (TREE_TYPE (TREE_VALUE (t))); + = TYPE_MODE (TREE_TYPE (argtype)); rtx mem = gen_rtx_MEM (indmode, x); cselib_val *val = cselib_lookup (mem, indmode, 0, VOIDmode); if (val && cselib_preserved_value_p (val)) @@ -5784,7 +5791,7 @@ prepare_call_arguments (basic_block bb, rtx insn) } } targetm.calls.function_arg_advance (&args_so_far, mode, - TREE_VALUE (t), true); + argtype, true); t = TREE_CHAIN (t); } } -- 2.30.2