compile with -m32 -Os -fno-inline void ws_f (void) { char b[10]; void ns_f (void) { char a[33]; __asm __volatile ("#%0 %1" : "=m" (a), "=m" (b) : : "fr28", "fr31"); } ns_f (); } results in ns_f.2345: stwu 1,-96(1) mflr 0 stfd 28,64(1) stw 0,100(1) stfd 31,88(1) [snip] addi 11,1,96 b _restfpr_28_x _restfpr_28_x will restore fr29 and fr30 from uninitialised stack.
Created attachment 27191 [details] obvious fix
Author: amodra Date: Fri Apr 20 09:33:19 2012 New Revision: 186616 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186616 Log: PR target/53040 * config/rs6000/rs6000.c (rs6000_savres_strategy): When using static chain, set REST_INLINE_FPRS too. Modified: trunk/gcc/ChangeLog trunk/gcc/config/rs6000/rs6000.c
Fixed. Not a regression so not applying to FSF branches.
Author: amodra Date: Wed Feb 6 02:46:13 2013 New Revision: 195778 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195778 Log: PR target/53040 * config/rs6000/rs6000.c (rs6000_savres_strategy): When using static chain, set REST_INLINE_FPRS too. Modified: branches/ibm/gcc-4_7-branch/gcc/ChangeLog.ibm branches/ibm/gcc-4_7-branch/gcc/config/rs6000/rs6000.c
Can you reconsider? If that's an obvious fix for an annoying target problem, then it should be put at least on the 4.7 branch. There are plenty of precedents for other targets (x86, SPARC, ARM, etc).
This one is hardly an annoying bug. You need a) nested functions, b) using floating point, c) with an unusual set of callee saved fprs, d) and -Os. I found the bug only because I wrote a fairly complete test for prologue/epilogue code. OTOH, the patch is quite obvious and completely safe..
> This one is hardly an annoying bug. You need > a) nested functions, > b) using floating point, > c) with an unusual set of callee saved fprs, > d) and -Os. a) + b) + d) is pretty much standard e.g. for embedded Ada on PowerPC/VxWorks. > OTOH, the patch is quite obvious and completely safe.. Then I think it's a good candidate for a backport onto the 4.7 branch.
Go ahead and backport it to 4.7 branch.
Author: amodra Date: Thu Feb 7 01:39:21 2013 New Revision: 195834 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195834 Log: PR target/53040 * config/rs6000/rs6000.c (rs6000_savres_strategy): When using static chain, set REST_INLINE_FPRS too. Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/config/rs6000/rs6000.c