From patchwork Wed Jul 21 07:15:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Fix PR44941 Date: Tue, 20 Jul 2010 21:15:17 -0000 From: IainS X-Patchwork-Id: 59405 Message-Id: <9DA9D36B-6A09-48E0-8B14-E4E41EE0A2D0@sandoe-acoustics.co.uk> To: Richard Guenther Cc: gcc-patches@gcc.gnu.org Hi Richard, On 19 Jul 2010, at 13:42, Richard Guenther wrote: > > This fixes PR44941 by early handling arguments of size zero. With > MEM_REF type-punned cases can now be registers which we do not handle > properly. After fixing this you can now see that we can avoid > generating > the stack slot for the zero-sized arg completely. > > Bootstrapped and tested on x86_64-unknown-linux-gnu. Comments? > 2010-07-19 Richard Guenther > > PR middle-end/44941 > * expr.c (emit_block_move_hints): Move zero size check first. > Move asserts to more useful places. > * calls.c (load_register_parameters): Check for zero size. > > * gcc.c-torture/compile/pr44941.c: New testcase. > { > rtx mem = validize_mem (args[i].value); The change to calls.c caused some compat/* fails on powerpc*-darwin9. As discussed on irc, (hopefully I understood what was wanted) the attached patch restores powerpc... ... whilst compile.exp=pr44941.c still passes on i686-darwin9. bootstrapped on {i686,powerpc}-darwin9 OK for trunk? Iain /* Handle a BLKmode that needs shifting. */ Index: gcc/calls.c =================================================================== --- gcc/calls.c (revision 162339) +++ gcc/calls.c (working copy) @@ -1668,15 +1668,16 @@ load_register_parameters (struct arg_data *args, i emit_move_insn (gen_rtx_REG (word_mode, REGNO (reg) + j), args[i].aligned_regs[j]); - else if ((partial == 0 || args[i].pass_on_stack) - && size != 0) + else if (partial == 0 || args[i].pass_on_stack) { rtx mem = validize_mem (args[i].value); - /* Check for overlap with already clobbered argument area. */ + /* Check for overlap with already clobbered argument area, + providing that this has finite size. */ if (is_sibcall - && mem_overlaps_already_clobbered_arg_p (XEXP (args[i].value, 0), - size)) + && (size == 0 + || mem_overlaps_already_clobbered_arg_p ( + XEXP (args[i].value, 0), size))) *sibcall_failure = 1;