From: Jeff Law Date: Thu, 17 Nov 2016 23:39:08 +0000 (-0700) Subject: re PR target/47192 (m68k target - gcc uses stack frame after it has been unlinked... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f2b6aad987ce2828f9b157a70bf76fada97a0a30;p=gcc.git re PR target/47192 (m68k target - gcc uses stack frame after it has been unlinked when compiling with -Os) PR target/47192 * config/m68k/m68k.c (m68k_expand_epilogue): Emit a scheduling barrier prior to deallocating the stack. PR target/47192 * gcc.target/m68k/pr47192.c: New test. From-SVN: r242575 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 24ed0f89b9e..86a8fdf7d76 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-11-17 Jeff Law + + PR target/47192 + * config/m68k/m68k.c (m68k_expand_epilogue): Emit a scheduling + barrier prior to deallocating the stack. + 2016-11-17 Andrew Burgess * config/arc/arc.md (cmem bit/sign-extend peephole2): New peephole diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index ce566926496..346c2dc6af3 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -1205,6 +1205,7 @@ m68k_expand_epilogue (bool sibcall_p) stack-based restore. */ emit_move_insn (gen_rtx_REG (Pmode, A1_REG), GEN_INT (-(current_frame.offset + fsize))); + emit_insn (gen_blockage ()); emit_insn (gen_addsi3 (stack_pointer_rtx, gen_rtx_REG (Pmode, A1_REG), frame_pointer_rtx)); @@ -1306,6 +1307,7 @@ m68k_expand_epilogue (bool sibcall_p) current_frame.fpu_mask, false, false); } + emit_insn (gen_blockage ()); if (frame_pointer_needed) emit_insn (gen_unlink (frame_pointer_rtx)); else if (fsize_with_regs) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 356d75aab42..5dd6f569a22 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-17 Jeff Law + + PR target/47192 + * gcc.target/m68k/pr47192.c: New test. + 2016-11-17 Toma Tabacu * gcc.target/mips/branch-cost-1.c (dg-options): Use (HAS_MOVN) diff --git a/gcc/testsuite/gcc.target/m68k/pr47192.c b/gcc/testsuite/gcc.target/m68k/pr47192.c new file mode 100644 index 00000000000..5bbef586632 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/pr47192.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=51qe -fdisable-ipa-pure-const -fdump-rtl-pro_and_epilogue" } */ +/* { dg-final { scan-rtl-dump-times "unspec_volatile" 1 "pro_and_epilogue"} } */ + + +char F(short *ty); + +short V(char cmd) +{ + static short st256; + static short stc; + short sc; + short scd; + short d; + + F(&sc); + + if (cmd == 4) + { + st256 = 0; + d = 0; + } + else + { + scd = sc - stc; + if (scd < -128) + { + scd += 256; + } + d = st256 >> 8; + st256 -= d << 8; + } + stc = sc; + return d; +} +