public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756)
@ 2011-07-18 23:20 Jakub Jelinek
  2011-07-19  8:42 ` Mike Stump
  2011-07-19  8:57 ` [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756, take 2) Jakub Jelinek
  0 siblings, 2 replies; 9+ messages in thread
From: Jakub Jelinek @ 2011-07-18 23:20 UTC (permalink / raw)
  To: gcc-patches

Hi!

Especially the FEs and gimplification are highly recursive on more complex
(especially badly generated) testcases, the following patch attempts to
increase stack size to 64MB if possible.  It is done in the driver
(where it can affect the children of the driver early) and also in
toplev_main to make similar results when invoking the compiler by hand,
unless mmap of some shared library or some other mmap make it impossible
to have such a large stack.

Bootstrapped/regtested on x86_64-linux and i686-linux, cures
gcc.c-torture/compile/limits-exprparen.c ICEs on x86_64-linux on all
-O* levels as well as the testcase from this PR (which is quite large and
compile time consuming, so not including it in this testcase).

2011-07-18  Jakub Jelinek  <jakub@redhat.com>

	PR c++/49756
	* gcc.c (main): Try to increase RLIMIT_STACK to at least
	64MB if possible.
	* toplev.c (toplev_main): Likewise.

--- gcc/gcc.c.jj	2011-07-08 15:09:38.000000000 +0200
+++ gcc/gcc.c	2011-07-18 21:13:18.000000000 +0200
@@ -6156,6 +6156,22 @@ main (int argc, char **argv)
   signal (SIGCHLD, SIG_DFL);
 #endif
 
+#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK) && defined(RLIM_INFINITY)
+  {
+    /* Parsing and gimplification sometimes need quite large stack.
+       Increase stack size limits if possible.  */
+    struct rlimit rlim;
+    if (getrlimit (RLIMIT_STACK, &rlim) == 0
+	&& rlim.rlim_cur != RLIM_INFINITY)
+      {
+	rlim.rlim_cur = MAX (rlim.rlim_cur, 64 * 1024 * 1024);
+	if (rlim.rlim_max != RLIM_INFINITY)
+	  rlim.rlim_cur = MIN (rlim.rlim_cur, rlim.rlim_max);
+	setrlimit (RLIMIT_STACK, &rlim);
+      }
+  }
+#endif
+
   /* Allocate the argument vector.  */
   alloc_args ();
 
--- gcc/toplev.c.jj	2011-07-11 10:39:50.000000000 +0200
+++ gcc/toplev.c	2011-07-18 21:14:24.000000000 +0200
@@ -1911,6 +1911,22 @@ do_compile (void)
 int
 toplev_main (int argc, char **argv)
 {
+#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK) && defined(RLIM_INFINITY)
+  {
+    /* Parsing and gimplification sometimes need quite large stack.
+       Increase stack size limits if possible.  */
+    struct rlimit rlim;
+    if (getrlimit (RLIMIT_STACK, &rlim) == 0
+	&& rlim.rlim_cur != RLIM_INFINITY)
+      {
+	rlim.rlim_cur = MAX (rlim.rlim_cur, 64 * 1024 * 1024);
+	if (rlim.rlim_max != RLIM_INFINITY)
+	  rlim.rlim_cur = MIN (rlim.rlim_cur, rlim.rlim_max);
+	setrlimit (RLIMIT_STACK, &rlim);
+      }
+  }
+#endif
+
   expandargv (&argc, &argv);
 
   /* Initialization of GCC's environment, and diagnostics.  */

	Jakub

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756)
  2011-07-18 23:20 [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756) Jakub Jelinek
@ 2011-07-19  8:42 ` Mike Stump
  2011-07-19  8:46   ` Mike Stump
  2011-07-19  8:57 ` [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756, take 2) Jakub Jelinek
  1 sibling, 1 reply; 9+ messages in thread
From: Mike Stump @ 2011-07-19  8:42 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Jul 18, 2011, at 2:58 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Especially the FEs and gimplification are highly recursive on more complex
> (especially badly generated) testcases, the following patch attempts to
> increase stack size to 64MB if possible.

No, you'd need a max in there or a condition to ensure the new code doesn't lower the limit for this to be true?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756)
  2011-07-19  8:42 ` Mike Stump
@ 2011-07-19  8:46   ` Mike Stump
  0 siblings, 0 replies; 9+ messages in thread
From: Mike Stump @ 2011-07-19  8:46 UTC (permalink / raw)
  To: Mike Stump; +Cc: Jakub Jelinek, gcc-patches

On Jul 19, 2011, at 12:56 AM, Mike Stump <mikestump@comcast.net> wrote:

> On Jul 18, 2011, at 2:58 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>> Especially the FEs and gimplification are highly recursive on more complex
>> (especially badly generated) testcases, the following patch attempts to
>> increase stack size to 64MB if possible.
> 
> No, you'd need a max in there or a condition to ensure the new code doesn't lower the limit for this to be true?

Ah, never mind I missed one little part of the patch.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756, take 2)
  2011-07-18 23:20 [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756) Jakub Jelinek
  2011-07-19  8:42 ` Mike Stump
@ 2011-07-19  8:57 ` Jakub Jelinek
  2011-07-19 10:18   ` Richard Guenther
  1 sibling, 1 reply; 9+ messages in thread
From: Jakub Jelinek @ 2011-07-19  8:57 UTC (permalink / raw)
  To: gcc-patches

On Mon, Jul 18, 2011 at 11:58:38PM +0200, Jakub Jelinek wrote:
> Especially the FEs and gimplification are highly recursive on more complex
> (especially badly generated) testcases, the following patch attempts to
> increase stack size to 64MB if possible.  It is done in the driver
> (where it can affect the children of the driver early) and also in
> toplev_main to make similar results when invoking the compiler by hand,
> unless mmap of some shared library or some other mmap make it impossible
> to have such a large stack.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, cures
> gcc.c-torture/compile/limits-exprparen.c ICEs on x86_64-linux on all
> -O* levels as well as the testcase from this PR (which is quite large and
> compile time consuming, so not including it in this testcase).

Here is a slightly modified variant which will avoid the setrlimit syscall
if it wouldn't change anything (which is either if the soft limit is already
>= 64MB or the hard limit is not infinity and equal to the soft limit).
At least in toplev_main it is very likely the setrlimit will not be needed
if it has been done in the driver already.

2011-07-19  Jakub Jelinek  <jakub@redhat.com>

	PR c++/49756
	* gcc.c (main): Try to increase RLIMIT_STACK to at least
	64MB if possible.
	* toplev.c (toplev_main): Likewise.

--- gcc/gcc.c.jj	2011-07-08 15:09:38.000000000 +0200
+++ gcc/gcc.c	2011-07-19 10:15:25.000000000 +0200
@@ -6156,6 +6156,24 @@ main (int argc, char **argv)
   signal (SIGCHLD, SIG_DFL);
 #endif
 
+#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK) && defined(RLIM_INFINITY)
+  {
+    /* Parsing and gimplification sometimes need quite large stack.
+       Increase stack size limits if possible.  */
+    struct rlimit rlim;
+    if (getrlimit (RLIMIT_STACK, &rlim) == 0
+	&& rlim.rlim_cur != RLIM_INFINITY
+	&& rlim.rlim_cur < 64 * 1024 * 1024
+	&& (rlim.rlim_max == RLIM_INFINITY || rlim.rlim_cur < rlim.rlim_max))
+      {
+	rlim.rlim_cur = 64 * 1024 * 1024;
+	if (rlim.rlim_max != RLIM_INFINITY)
+	  rlim.rlim_cur = MIN (rlim.rlim_cur, rlim.rlim_max);
+	setrlimit (RLIMIT_STACK, &rlim);
+      }
+  }
+#endif
+
   /* Allocate the argument vector.  */
   alloc_args ();
 
--- gcc/toplev.c.jj	2011-07-11 10:39:50.000000000 +0200
+++ gcc/toplev.c	2011-07-19 10:15:37.000000000 +0200
@@ -1911,6 +1911,24 @@ do_compile (void)
 int
 toplev_main (int argc, char **argv)
 {
+#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK) && defined(RLIM_INFINITY)
+  {
+    /* Parsing and gimplification sometimes need quite large stack.
+       Increase stack size limits if possible.  */
+    struct rlimit rlim;
+    if (getrlimit (RLIMIT_STACK, &rlim) == 0
+	&& rlim.rlim_cur != RLIM_INFINITY
+	&& rlim.rlim_cur < 64 * 1024 * 1024
+	&& (rlim.rlim_max == RLIM_INFINITY || rlim.rlim_cur < rlim.rlim_max))
+      {
+	rlim.rlim_cur = 64 * 1024 * 1024;
+	if (rlim.rlim_max != RLIM_INFINITY)
+	  rlim.rlim_cur = MIN (rlim.rlim_cur, rlim.rlim_max);
+	setrlimit (RLIMIT_STACK, &rlim);
+      }
+  }
+#endif
+
   expandargv (&argc, &argv);
 
   /* Initialization of GCC's environment, and diagnostics.  */

	Jakub

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756, take 2)
  2011-07-19  8:57 ` [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756, take 2) Jakub Jelinek
@ 2011-07-19 10:18   ` Richard Guenther
  2011-07-21 15:19     ` [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756, take 3) Jakub Jelinek
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Guenther @ 2011-07-19 10:18 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Tue, Jul 19, 2011 at 10:24 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Jul 18, 2011 at 11:58:38PM +0200, Jakub Jelinek wrote:
>> Especially the FEs and gimplification are highly recursive on more complex
>> (especially badly generated) testcases, the following patch attempts to
>> increase stack size to 64MB if possible.  It is done in the driver
>> (where it can affect the children of the driver early) and also in
>> toplev_main to make similar results when invoking the compiler by hand,
>> unless mmap of some shared library or some other mmap make it impossible
>> to have such a large stack.
>>
>> Bootstrapped/regtested on x86_64-linux and i686-linux, cures
>> gcc.c-torture/compile/limits-exprparen.c ICEs on x86_64-linux on all
>> -O* levels as well as the testcase from this PR (which is quite large and
>> compile time consuming, so not including it in this testcase).
>
> Here is a slightly modified variant which will avoid the setrlimit syscall
> if it wouldn't change anything (which is either if the soft limit is already
>>= 64MB or the hard limit is not infinity and equal to the soft limit).
> At least in toplev_main it is very likely the setrlimit will not be needed
> if it has been done in the driver already.

Looks like sth for libiberty to avoid replicating it two times?

Richard.

> 2011-07-19  Jakub Jelinek  <jakub@redhat.com>
>
>        PR c++/49756
>        * gcc.c (main): Try to increase RLIMIT_STACK to at least
>        64MB if possible.
>        * toplev.c (toplev_main): Likewise.
>
> --- gcc/gcc.c.jj        2011-07-08 15:09:38.000000000 +0200
> +++ gcc/gcc.c   2011-07-19 10:15:25.000000000 +0200
> @@ -6156,6 +6156,24 @@ main (int argc, char **argv)
>   signal (SIGCHLD, SIG_DFL);
>  #endif
>
> +#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK) && defined(RLIM_INFINITY)
> +  {
> +    /* Parsing and gimplification sometimes need quite large stack.
> +       Increase stack size limits if possible.  */
> +    struct rlimit rlim;
> +    if (getrlimit (RLIMIT_STACK, &rlim) == 0
> +       && rlim.rlim_cur != RLIM_INFINITY
> +       && rlim.rlim_cur < 64 * 1024 * 1024
> +       && (rlim.rlim_max == RLIM_INFINITY || rlim.rlim_cur < rlim.rlim_max))
> +      {
> +       rlim.rlim_cur = 64 * 1024 * 1024;
> +       if (rlim.rlim_max != RLIM_INFINITY)
> +         rlim.rlim_cur = MIN (rlim.rlim_cur, rlim.rlim_max);
> +       setrlimit (RLIMIT_STACK, &rlim);
> +      }
> +  }
> +#endif
> +
>   /* Allocate the argument vector.  */
>   alloc_args ();
>
> --- gcc/toplev.c.jj     2011-07-11 10:39:50.000000000 +0200
> +++ gcc/toplev.c        2011-07-19 10:15:37.000000000 +0200
> @@ -1911,6 +1911,24 @@ do_compile (void)
>  int
>  toplev_main (int argc, char **argv)
>  {
> +#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK) && defined(RLIM_INFINITY)
> +  {
> +    /* Parsing and gimplification sometimes need quite large stack.
> +       Increase stack size limits if possible.  */
> +    struct rlimit rlim;
> +    if (getrlimit (RLIMIT_STACK, &rlim) == 0
> +       && rlim.rlim_cur != RLIM_INFINITY
> +       && rlim.rlim_cur < 64 * 1024 * 1024
> +       && (rlim.rlim_max == RLIM_INFINITY || rlim.rlim_cur < rlim.rlim_max))
> +      {
> +       rlim.rlim_cur = 64 * 1024 * 1024;
> +       if (rlim.rlim_max != RLIM_INFINITY)
> +         rlim.rlim_cur = MIN (rlim.rlim_cur, rlim.rlim_max);
> +       setrlimit (RLIMIT_STACK, &rlim);
> +      }
> +  }
> +#endif
> +
>   expandargv (&argc, &argv);
>
>   /* Initialization of GCC's environment, and diagnostics.  */
>
>        Jakub
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756, take 3)
  2011-07-19 10:18   ` Richard Guenther
@ 2011-07-21 15:19     ` Jakub Jelinek
  2011-07-21 18:32       ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Jelinek @ 2011-07-21 15:19 UTC (permalink / raw)
  To: Richard Guenther, DJ Delorie, Ian Lance Taylor; +Cc: gcc-patches

On Tue, Jul 19, 2011 at 11:01:10AM +0200, Richard Guenther wrote:
> Looks like sth for libiberty to avoid replicating it two times?

Done as follows:

2011-07-21  Jakub Jelinek  <jakub@redhat.com>

	PR c++/49756
	* libiberty.h (stack_limit_increase): New prototype.

	* stack-limit.c: New file.
	* Makefile.in: Regenerate deps.
	(CFILES): Add stack-limit.c.
	(REQUIRED_OFILES): Add ./stack-limit.$(objext).
	* configure.ac (checkfuncs): Add getrlimit and setrlimit.
	(AC_CHECK_FUNCS): Likewise.
	* configure: Regenerated.
	* config.in: Regenerated.

	* gcc.c (main): Call stack_limit_increase (64MB).
	* toplev.c (toplev_main): Likewise.

--- include/libiberty.h.jj	2011-01-06 10:21:58.000000000 +0100
+++ include/libiberty.h	2011-07-21 16:04:44.000000000 +0200
@@ -1,7 +1,7 @@
 /* Function declarations for libiberty.
 
    Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
    
    Note - certain prototypes declared in this header file are for
    functions whoes implementation copyright does not belong to the
@@ -637,6 +637,9 @@ extern int strverscmp (const char *, con
 /* Set the title of a process */
 extern void setproctitle (const char *name, ...);
 
+/* Increase stack limit if possible.  */
+extern void stack_limit_increase (unsigned long);
+
 #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
 
 /* Drastically simplified alloca configurator.  If we're using GCC,
--- libiberty/stack-limit.c.jj	2011-07-21 15:50:32.000000000 +0200
+++ libiberty/stack-limit.c	2011-07-21 16:03:06.000000000 +0200
@@ -0,0 +1,59 @@
+/* Increase stack size limit if possible.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+This file is part of the libiberty library.  This library is free
+software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 51 Franklin Street - Fifth Floor,
+Boston, MA 02110-1301, USA.
+
+As a special exception, if you link this library with files
+compiled with a GNU compiler to produce an executable, this does not cause
+the resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why
+the executable file might be covered by the GNU General Public License. */
+
+/*
+
+@deftypefn Extension void stack_limit_increase (unsigned long @var{pref})
+
+Attempt to increase stack size limit to @var{pref} bytes if possible.
+
+@end deftypefn
+
+*/
+
+#include "config.h"
+
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+void
+stack_limit_increase (unsigned long pref)
+{
+#if defined(HAVE_SETRLIMIT) && defined(HAVE_GETRLIMIT) \
+    && defined(RLIMIT_STACK) && defined(RLIM_INFINITY)
+  struct rlimit rlim;
+  if (getrlimit (RLIMIT_STACK, &rlim) == 0
+      && rlim.rlim_cur != RLIM_INFINITY
+      && rlim.rlim_cur < pref
+      && (rlim.rlim_max == RLIM_INFINITY || rlim.rlim_cur < rlim.rlim_max))
+    {
+      rlim.rlim_cur = pref;
+      if (rlim.rlim_max != RLIM_INFINITY && rlim.rlim_cur > rlim.rlim_max)
+	rlim.rlim_cur = rlim.rlim_max;
+      setrlimit (RLIMIT_STACK, &rlim);
+    }
+#endif
+}
--- libiberty/Makefile.in.jj	2010-11-26 18:39:19.000000000 +0100
+++ libiberty/Makefile.in	2011-07-21 16:01:11.000000000 +0200
@@ -2,7 +2,7 @@
 # Originally written by K. Richard Pixley <rich@cygnus.com>.
 #
 # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 # Free Software Foundation
 #
 # This file is part of the libiberty library.
@@ -148,10 +148,10 @@ CFILES = alloca.c argv.c asprintf.c atex
 	 simple-object.c simple-object-coff.c simple-object-elf.c	\
 	 simple-object-mach-o.c						\
          snprintf.c sort.c						\
-	 spaces.c splay-tree.c stpcpy.c stpncpy.c strcasecmp.c		\
-	 strchr.c strdup.c strerror.c strncasecmp.c strncmp.c		\
-	 strrchr.c strsignal.c strstr.c strtod.c strtol.c strtoul.c	\
-	 strndup.c strverscmp.c						\
+	 spaces.c splay-tree.c stack-limit.c stpcpy.c stpncpy.c		\
+	 strcasecmp.c strchr.c strdup.c strerror.c strncasecmp.c	\
+	 strncmp.c strrchr.c strsignal.c strstr.c strtod.c strtol.c	\
+	 strtoul.c strndup.c strverscmp.c				\
 	tmpnam.c							\
 	unlink-if-ordinary.c						\
 	vasprintf.c vfork.c vfprintf.c vprintf.c vsnprintf.c vsprintf.c	\
@@ -183,7 +183,8 @@ REQUIRED_OFILES =							\
 	./simple-object.$(objext) ./simple-object-coff.$(objext)	\
 	./simple-object-elf.$(objext) ./simple-object-mach-o.$(objext)	\
 	./sort.$(objext) ./spaces.$(objext)				\
-	./splay-tree.$(objext) ./strerror.$(objext)			\
+	./splay-tree.$(objext) ./stack-limit.$(objext)			\
+	./strerror.$(objext)						\
 	./strsignal.$(objext) ./unlink-if-ordinary.$(objext)		\
 	./xatexit.$(objext) ./xexit.$(objext) ./xmalloc.$(objext)	\
 	./xmemdup.$(objext) ./xstrdup.$(objext) ./xstrerror.$(objext)	\
@@ -1033,6 +1034,12 @@ $(CONFIGURED_OFILES): stamp-picdir
 	else true; fi
 	$(COMPILE.c) $(srcdir)/splay-tree.c $(OUTPUT_OPTION)
 
+./stack-limit.$(objext): $(srcdir)/stack-limit.c config.h
+	if [ x"$(PICFLAG)" != x ]; then \
+	  $(COMPILE.c) $(PICFLAG) $(srcdir)/stack-limit.c -o pic/$@; \
+	else true; fi
+	$(COMPILE.c) $(srcdir)/stack-limit.c $(OUTPUT_OPTION)
+
 ./stpcpy.$(objext): $(srcdir)/stpcpy.c $(INCDIR)/ansidecl.h
 	if [ x"$(PICFLAG)" != x ]; then \
 	  $(COMPILE.c) $(PICFLAG) $(srcdir)/stpcpy.c -o pic/$@; \
--- libiberty/configure.ac.jj	2010-11-26 18:39:19.000000000 +0100
+++ libiberty/configure.ac	2011-07-21 15:41:55.000000000 +0200
@@ -358,10 +358,10 @@ funcs="$funcs setproctitle"
 
 vars="sys_errlist sys_nerr sys_siglist"
 
-checkfuncs="__fsetlocking canonicalize_file_name dup3 getrusage getsysinfo \
- gettimeofday on_exit psignal pstat_getdynamic pstat_getstatic realpath \
- sbrk spawnve spawnvpe strerror strsignal sysconf sysctl sysmp table \
- times wait3 wait4"
+checkfuncs="__fsetlocking canonicalize_file_name dup3 getrlimit getrusage \
+ getsysinfo gettimeofday on_exit psignal pstat_getdynamic pstat_getstatic \
+ realpath setrlimit sbrk spawnve spawnvpe strerror strsignal sysconf sysctl \
+ sysmp table times wait3 wait4"
 
 # These are neither executed nor required, but they help keep
 # autoheader happy without adding a bunch of text to acconfig.h.
@@ -371,13 +371,13 @@ if test "x" = "y"; then
     calloc canonicalize_file_name clock \
     dup3 \
     ffs __fsetlocking \
-    getcwd getpagesize getrusage getsysinfo gettimeofday \
+    getcwd getpagesize getrlimit getrusage getsysinfo gettimeofday \
     index insque \
     memchr memcmp memcpy memmem memmove memset mkstemps \
     on_exit \
     psignal pstat_getdynamic pstat_getstatic putenv \
     random realpath rename rindex \
-    sbrk setenv setproctitle sigsetmask snprintf spawnve spawnvpe \
+    sbrk setenv setproctitle setrlimit sigsetmask snprintf spawnve spawnvpe \
      stpcpy stpncpy strcasecmp strchr strdup \
      strerror strncasecmp strndup strrchr strsignal strstr strtod strtol \
      strtoul strverscmp sysconf sysctl sysmp \
--- libiberty/configure.jj	2010-11-26 18:39:19.000000000 +0100
+++ libiberty/configure	2011-07-21 15:42:12.000000000 +0200
@@ -5293,10 +5293,10 @@ funcs="$funcs setproctitle"
 
 vars="sys_errlist sys_nerr sys_siglist"
 
-checkfuncs="__fsetlocking canonicalize_file_name dup3 getrusage getsysinfo \
- gettimeofday on_exit psignal pstat_getdynamic pstat_getstatic realpath \
- sbrk spawnve spawnvpe strerror strsignal sysconf sysctl sysmp table \
- times wait3 wait4"
+checkfuncs="__fsetlocking canonicalize_file_name dup3 getrlimit getrusage \
+ getsysinfo gettimeofday on_exit psignal pstat_getdynamic pstat_getstatic \
+ realpath setrlimit sbrk spawnve spawnvpe strerror strsignal sysconf sysctl \
+ sysmp table times wait3 wait4"
 
 # These are neither executed nor required, but they help keep
 # autoheader happy without adding a bunch of text to acconfig.h.
@@ -5306,13 +5306,13 @@ if test "x" = "y"; then
     calloc canonicalize_file_name clock \
     dup3 \
     ffs __fsetlocking \
-    getcwd getpagesize getrusage getsysinfo gettimeofday \
+    getcwd getpagesize getrlimit getrusage getsysinfo gettimeofday \
     index insque \
     memchr memcmp memcpy memmem memmove memset mkstemps \
     on_exit \
     psignal pstat_getdynamic pstat_getstatic putenv \
     random realpath rename rindex \
-    sbrk setenv setproctitle sigsetmask snprintf spawnve spawnvpe \
+    sbrk setenv setproctitle setrlimit sigsetmask snprintf spawnve spawnvpe \
      stpcpy stpncpy strcasecmp strchr strdup \
      strerror strncasecmp strndup strrchr strsignal strstr strtod strtol \
      strtoul strverscmp sysconf sysctl sysmp \
--- libiberty/config.in.jj	2010-11-26 18:39:19.000000000 +0100
+++ libiberty/config.in	2011-07-21 15:42:14.000000000 +0200
@@ -109,6 +109,9 @@
 /* Define to 1 if you have the `getpagesize' function. */
 #undef HAVE_GETPAGESIZE
 
+/* Define to 1 if you have the `getrlimit' function. */
+#undef HAVE_GETRLIMIT
+
 /* Define to 1 if you have the `getrusage' function. */
 #undef HAVE_GETRUSAGE
 
@@ -205,6 +208,9 @@
 /* Define to 1 if you have the `setproctitle' function. */
 #undef HAVE_SETPROCTITLE
 
+/* Define to 1 if you have the `setrlimit' function. */
+#undef HAVE_SETRLIMIT
+
 /* Define to 1 if you have the `sigsetmask' function. */
 #undef HAVE_SIGSETMASK
 
--- gcc/gcc.c.jj	2011-07-21 09:54:31.000000000 +0200
+++ gcc/gcc.c	2011-07-21 16:07:32.000000000 +0200
@@ -6156,6 +6156,10 @@ main (int argc, char **argv)
   signal (SIGCHLD, SIG_DFL);
 #endif
 
+  /* Parsing and gimplification sometimes need quite large stack.
+     Increase stack size limits if possible.  */
+  stack_limit_increase (64 * 1024 * 1024);
+
   /* Allocate the argument vector.  */
   alloc_args ();
 
--- gcc/toplev.c.jj	2011-07-21 09:54:31.000000000 +0200
+++ gcc/toplev.c	2011-07-21 16:06:28.000000000 +0200
@@ -1911,6 +1911,10 @@ do_compile (void)
 int
 toplev_main (int argc, char **argv)
 {
+  /* Parsing and gimplification sometimes need quite large stack.
+     Increase stack size limits if possible.  */
+  stack_limit_increase (64 * 1024 * 1024);
+
   expandargv (&argc, &argv);
 
   /* Initialization of GCC's environment, and diagnostics.  */


	Jakub

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756, take 3)
  2011-07-21 15:19     ` [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756, take 3) Jakub Jelinek
@ 2011-07-21 18:32       ` Ian Lance Taylor
  2011-07-22 23:01         ` Gerald Pfeifer
  0 siblings, 1 reply; 9+ messages in thread
From: Ian Lance Taylor @ 2011-07-21 18:32 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Richard Guenther, DJ Delorie, gcc-patches

Jakub Jelinek <jakub@redhat.com> writes:

> 2011-07-21  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR c++/49756
> 	* libiberty.h (stack_limit_increase): New prototype.
>
> 	* stack-limit.c: New file.
> 	* Makefile.in: Regenerate deps.
> 	(CFILES): Add stack-limit.c.
> 	(REQUIRED_OFILES): Add ./stack-limit.$(objext).
> 	* configure.ac (checkfuncs): Add getrlimit and setrlimit.
> 	(AC_CHECK_FUNCS): Likewise.
> 	* configure: Regenerated.
> 	* config.in: Regenerated.
>
> 	* gcc.c (main): Call stack_limit_increase (64MB).
> 	* toplev.c (toplev_main): Likewise.

This is OK.

Thanks.

Ian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756, take 3)
  2011-07-21 18:32       ` Ian Lance Taylor
@ 2011-07-22 23:01         ` Gerald Pfeifer
  2011-07-22 23:22           ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: Gerald Pfeifer @ 2011-07-22 23:01 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: Jakub Jelinek, Richard Guenther, DJ Delorie, gcc-patches

On Thu, 21 Jul 2011, Ian Lance Taylor wrote:
>> 2011-07-21  Jakub Jelinek  <jakub@redhat.com>
>>
>> 	PR c++/49756
>> 	* libiberty.h (stack_limit_increase): New prototype.
>>
>> 	* stack-limit.c: New file.
>> 	* Makefile.in: Regenerate deps.
>> 	(CFILES): Add stack-limit.c.
>> 	(REQUIRED_OFILES): Add ./stack-limit.$(objext).
>> 	* configure.ac (checkfuncs): Add getrlimit and setrlimit.
>> 	(AC_CHECK_FUNCS): Likewise.
>> 	* configure: Regenerated.
>> 	* config.in: Regenerated.
>>
>> 	* gcc.c (main): Call stack_limit_increase (64MB).
>> 	* toplev.c (toplev_main): Likewise.
> This is OK.

I'm afraid it's not:

.../gcc-HEAD/libiberty/stack-limit.c: In function 'stack_limit_increase':
.../gcc-HEAD/libiberty/stack-limit.c:49: error: 'uint64_t' undeclared (first use in this function)

That puzzled me at first, but FreeBSD defines RLIM_INFINITY in 
/usr/include/sys/resource.h and as follows:

  ((rlim_t)(((uint64_t)1 << 63) - 1))

Luckily, the fix is simple and bootstrap on i386-unknown-freebsd9.0 has
proceeded beyond the previous failure point.

Okay?

Gerald


2011-07-22  Gerald Pfeifer  <gerald@pfeifer.com>

	PR target/49817
	* stack-limit.c: Include <stdint.h>.

Index: stack-limit.c
===================================================================
--- stack-limit.c	(revision 176657)
+++ stack-limit.c	(working copy)
@@ -35,6 +35,9 @@
 
 #include "config.h"
 
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
 #ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
 #endif

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756, take 3)
  2011-07-22 23:01         ` Gerald Pfeifer
@ 2011-07-22 23:22           ` Ian Lance Taylor
  0 siblings, 0 replies; 9+ messages in thread
From: Ian Lance Taylor @ 2011-07-22 23:22 UTC (permalink / raw)
  To: Gerald Pfeifer; +Cc: Jakub Jelinek, Richard Guenther, DJ Delorie, gcc-patches

Gerald Pfeifer <gerald@pfeifer.com> writes:

> That puzzled me at first, but FreeBSD defines RLIM_INFINITY in 
> /usr/include/sys/resource.h and as follows:
>
>   ((rlim_t)(((uint64_t)1 << 63) - 1))

Oy.


> 2011-07-22  Gerald Pfeifer  <gerald@pfeifer.com>
>
> 	PR target/49817
> 	* stack-limit.c: Include <stdint.h>.

This is OK.

Thanks.

Ian

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-07-22 22:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-18 23:20 [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756) Jakub Jelinek
2011-07-19  8:42 ` Mike Stump
2011-07-19  8:46   ` Mike Stump
2011-07-19  8:57 ` [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756, take 2) Jakub Jelinek
2011-07-19 10:18   ` Richard Guenther
2011-07-21 15:19     ` [PATCH] Attempt to increase RLIMIT_STACK in the driver as well as compiler (PR c++/49756, take 3) Jakub Jelinek
2011-07-21 18:32       ` Ian Lance Taylor
2011-07-22 23:01         ` Gerald Pfeifer
2011-07-22 23:22           ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).