On Sun, Sep 25, 2011 at 2:35 PM, Joern Rennecke <amyl...@spamcop.net> wrote:
> This patch has not been reviewed for eight weeks.
>
> ----- Forwarded message from amyl...@spamcop.net -----
>    Date: Mon, 01 Aug 2011 00:41:04 -0400
>    From: Joern Rennecke <amyl...@spamcop.net>
> Reply-To: Joern Rennecke <amyl...@spamcop.net>
>  Subject: RFA: Testsuite fixes (1/3): builtin_apply
>      To: gcc-patches@gcc.gnu.org
>
> I am working with a toolchain that is frugal with stack usage at startup, so
> an attempt to read dozens more bytes than have been pushed causes unmapped
> memory references.
>
> Fixed by adding an automatic variable that occupies sufficient space.
>
> Regression tested with x86_64-unknown-linux-gnu X sh-elf .
> No change there, as the default SH liker script places the stack at 3M,
> and the default simulator size is 16M.
>
>
> ----- End forwarded message -----
>
>
> 2011-07-21  Joern Rennecke <joern.renne...@embecosm.com>
>
>        * gcc.dg/torture/stackalign/builtin-apply2.c:
>        Make sure we don't read past the bottom of the stack.
>
> 2009-09-24  Joern Rennecke <joern.renne...@embecosm.com>
>
>        * gcc.dg/builtin-apply2.c: Make sure we don't read past the bottom of
>        the stack.
>
> Index: gcc.dg/torture/stackalign/builtin-apply-2.c
> ===================================================================
> --- gcc.dg/torture/stackalign/builtin-apply-2.c
> (.../GNU/fsf-gcc/trunk/gcc/testsuite)   (revision 2013)
> +++ gcc.dg/torture/stackalign/builtin-apply-2.c
> (.../Customer-Projects/X/branches/Y-20110628/toolchain/gcc-4.7.0-20110701/gcc/testsuite)
>        (revision 2013)
> @@ -24,7 +24,10 @@ void bar(char *name, ...)
>
>  int main(void)
>  {
> -  bar("eeee", 5.444567, 8.90765, 4.567789, INTEGER_ARG);
> +  /* Make sure that there is some stack that can be legitimately read.  */
> +  char dummy[64];
> +
> +  bar(dummy, 5.444567, 8.90765, 4.567789, INTEGER_ARG);
>
>   return 0;
>  }
> Index: gcc.dg/builtin-apply2.c
> ===================================================================
> --- gcc.dg/builtin-apply2.c     (.../GNU/fsf-gcc/trunk/gcc/testsuite)
> (revision 2013)
> +++ gcc.dg/builtin-apply2.c
> (.../Customer-Projects/X/branches/Y-20110628/toolchain/gcc-4.7.0-20110701/gcc/testsuite)
>        (revision 2013)
> @@ -36,6 +36,9 @@ void bar(char *name, ...)
>
>  int main(void)
>  {
> +  /* Make sure that there is some stack that can be legitimately read.  */
> +  char dummy[64];
> +

How is this ever the correct thing to do?  Why doesn't this trigger
for user code as well?
It really looks like you are papering over backend issues here.

Richard.

>   bar("eeee", 5.444567, 8.90765, 4.567789, INTEGER_ARG);
>
>   return 0;
>
>

Reply via email to