This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Allocate constant size dynamic stack space in the prologue


On Thu, Jun 23, 2016 at 04:48:14PM +0100, Dominik Vogt wrote:
> Third version of the patch.  Changes:
> 
>  * Corrected a typo in a test case comment.
>  * Verify that stack variable alignment does not force the frame
>    pointer into existence (with -fomit-frame-pointer)
> 
> The test should hopefully run on all targets.  Tested on s390,
> s390x biarch, x86_64.  The only open question I'm aware of is the
> stack-usage-2.c test.  I guess foo3() will not generate
> 
>   stack usage might be ... bytes
> 
> On any target anymore, and using alloca() with a constant size
> results in "unbounded".  It's unclear to me whether that message
> is ever generated, and if so, how to trigger it.

> --- a/gcc/cfgexpand.c
> +++ b/gcc/cfgexpand.c
> @@ -1186,6 +1190,18 @@ expand_stack_vars (bool (*pred) (size_t), struct stack_vars_data *data)
>  	  /* Large alignment is only processed in the last pass.  */
>  	  if (pred)
>  	    continue;
> +
> +	  if (large_allocsize && ! large_allocation_done)
> +	    {
> +	      /* Allocate space the virtual stack vars area in the
> +	         prologue.  */
> +	      HOST_WIDE_INT loffset;
> +
> +	      loffset = alloc_stack_frame_space (INTVAL (large_allocsize),
> +						 PREFERRED_STACK_BOUNDARY);
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^

Uh, this must be PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]