Updated version of the patch described below. Apart from fixing a bug and adding a test, the new logic is now used always, for all targets. The discussion of the original patch starts here: https://gcc.gnu.org/ml/gcc-patches/2015-11/msg03052.html The new patch has been bootstrapped and regression tested on s390, s390x and x86_64, but please check the questions/comments in the follow up message. On Wed, Nov 25, 2015 at 01:56:10PM +0100, Dominik Vogt wrote: > The attached patch fixes a warning during Linux kernel compilation > on S/390 due to -mwarn-dynamicstack and runtime alignment of stack > variables with constant size causing cfun->calls_alloca to be set > (even if alloca is not used at all). The patched code places > constant size runtime aligned variables in the "virtual stack > vars" area instead of creating a "virtual stack dynamic" area. > > This behaviour is activated by defining > > #define ALLOCATE_DYNAMIC_STACK_SPACE_IN_PROLOGUE 1 > > in the backend; otherwise the old logic is used. > > The kernel uses runtime alignment for the page structure (aligned > to 16 bytes), and apart from triggereing the alloca warning > (-mwarn-dynamicstack), the current Gcc also generates inefficient > code like > > aghi %r15,-160 # prologue: create stack frame > lgr %r11,%r15 # prologue: generate frame pointer > aghi %r15,-32 # space for dynamic stack > > which could be simplified to > > aghi %r15,-192 > > (if later optimization passes are able to get rid of the frame > pointer). Is there a specific reason why the patched behaviour > shouldn't be used for all platforms? > > -- > > As the placement of runtime aligned stack variables with constant > size is done completely in the middleend, I don't see a way to fix > this in the backend. Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany