From: Jakub Jelinek Date: Thu, 6 Mar 2014 08:02:46 +0000 (+0100) Subject: backport: re PR target/43546 (ICE: in assign_stack_local_1, at function.c:353 with... X-Git-Tag: releases/gcc-4.8.3~286 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27547c838eacaa65758f84e3dc0f58b2d1c62729;p=thirdparty%2Fgcc.git backport: re PR target/43546 (ICE: in assign_stack_local_1, at function.c:353 with -mpreferred-stack-boundary=2 -msseregparm) Backport from mainline 2014-02-13 Jakub Jelinek PR target/43546 * expr.c (compress_float_constant): If x is a hard register, extend into a pseudo and then move to x. * gcc.target/i386/pr43546.c: New test. From-SVN: r208369 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eeed95ae7756..ac038e41555a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2014-03-06 Jakub Jelinek Backport from mainline + 2014-02-13 Jakub Jelinek + + PR target/43546 + * expr.c (compress_float_constant): If x is a hard register, + extend into a pseudo and then move to x. + 2014-02-11 Richard Henderson Jakub Jelinek diff --git a/gcc/expr.c b/gcc/expr.c index d39bdce4caf4..01697e99ac87 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -3611,12 +3611,21 @@ compress_float_constant (rtx x, rtx y) into a new pseudo. This constant may be used in different modes, and if not, combine will put things back together for us. */ trunc_y = force_reg (srcmode, trunc_y); - emit_unop_insn (ic, x, trunc_y, UNKNOWN); + + /* If x is a hard register, perform the extension into a pseudo, + so that e.g. stack realignment code is aware of it. */ + rtx target = x; + if (REG_P (x) && HARD_REGISTER_P (x)) + target = gen_reg_rtx (dstmode); + + emit_unop_insn (ic, target, trunc_y, UNKNOWN); last_insn = get_last_insn (); - if (REG_P (x)) + if (REG_P (target)) set_unique_reg_note (last_insn, REG_EQUAL, y); + if (target != x) + return emit_move_insn (x, target); return last_insn; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 29e3975fa6ab..425cbf690faf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2014-03-06 Jakub Jelinek Backport from mainline + 2014-02-13 Jakub Jelinek + + PR target/43546 + * gcc.target/i386/pr43546.c: New test. + 2014-02-12 Jakub Jelinek PR c/60101 diff --git a/gcc/testsuite/gcc.target/i386/pr43546.c b/gcc/testsuite/gcc.target/i386/pr43546.c new file mode 100644 index 000000000000..53cb3a07fdf0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr43546.c @@ -0,0 +1,12 @@ +/* PR target/43546 */ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ +/* { dg-additional-options "-mpreferred-stack-boundary=2 -msseregparm -msse" { target ia32 } } */ + +extern void bar (double); + +void +foo (void) +{ + bar (1.0); +}