diff mbox

Fix tst-setcontext9 for optimized small stacks.

Message ID mvm5zyr8fm6.fsf@suse.de
State New
Headers show

Commit Message

Andreas Schwab Sept. 27, 2018, 9:16 a.m. UTC
On Sep 26 2018, Carlos O'Donell <carlos@redhat.com> wrote:

> Does it run out of stack?

Definitely.

Andreas.

	[BZ #23717]
	* stdlib/tst-setcontext9.c (f1a): Make st2 static.
	(do_test): Make st1 static.
---
 stdlib/tst-setcontext9.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Florian Weimer Sept. 27, 2018, 10:06 a.m. UTC | #1
* Andreas Schwab:

> On Sep 26 2018, Carlos O'Donell <carlos@redhat.com> wrote:
>
>> Does it run out of stack?
>
> Definitely.
>
> Andreas.
>
> 	[BZ #23717]
> 	* stdlib/tst-setcontext9.c (f1a): Make st2 static.
> 	(do_test): Make st1 static.

I'm happy to report that this fixes powerpc64le for me.  The change
looks reasonable.  Maybe you coulkd mention somewhere (in the ChangeLog
entry or the commit message) that this is to reduce stack usage and
avoid stack overflows.

Thanks,
Florian
Carlos O'Donell Sept. 27, 2018, 6:26 p.m. UTC | #2
On 9/27/18 5:16 AM, Andreas Schwab wrote:
> On Sep 26 2018, Carlos O'Donell <carlos@redhat.com> wrote:
> 
>> Does it run out of stack?
> 
> Definitely.

Thanks for fixing this. I was a dummy.

> Andreas.
> 
> 	[BZ #23717]
> 	* stdlib/tst-setcontext9.c (f1a): Make st2 static.
> 	(do_test): Make st1 static.
> ---
>  stdlib/tst-setcontext9.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/stdlib/tst-setcontext9.c b/stdlib/tst-setcontext9.c
> index db8355766c..009928235d 100644
> --- a/stdlib/tst-setcontext9.c
> +++ b/stdlib/tst-setcontext9.c
> @@ -58,7 +58,7 @@ f1b (void)
>  static void
>  f1a (void)
>  {
> -  char st2[32768];
> +  static char st2[32768];
>    puts ("start f1a");
>    if (getcontext (&ctx[2]) != 0)
>      {
> @@ -93,7 +93,7 @@ f1a (void)
>  static int
>  do_test (void)
>  {
> -  char st1[32768];
> +  static char st1[32768];
>    puts ("making contexts");
>    if (getcontext (&ctx[0]) != 0)
>      {
>
diff mbox

Patch

diff --git a/stdlib/tst-setcontext9.c b/stdlib/tst-setcontext9.c
index db8355766c..009928235d 100644
--- a/stdlib/tst-setcontext9.c
+++ b/stdlib/tst-setcontext9.c
@@ -58,7 +58,7 @@  f1b (void)
 static void
 f1a (void)
 {
-  char st2[32768];
+  static char st2[32768];
   puts ("start f1a");
   if (getcontext (&ctx[2]) != 0)
     {
@@ -93,7 +93,7 @@  f1a (void)
 static int
 do_test (void)
 {
-  char st1[32768];
+  static char st1[32768];
   puts ("making contexts");
   if (getcontext (&ctx[0]) != 0)
     {