This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Do not inline buffered_vfprintf


With the new inliner in GCC (tested with the hammer-branch), GCC
inlines buffered_vfprintf into vfprintf and the stack size of that
function increases since buffered_vfprintf puts CHAR_T buf[_IO_BUFSIZ]
on the stack which is 8192 bytes.


This leads - on at least i686 and x86_64 - to test failures in those
tests where we have a user-supplied stack: stdlib/tst-setcontext.c
(user stack is exactly 8192 bytes), linuxthreads/tst-context.c (user
stack is exactly 8192 bytes) and nptl/tst-context1.c.

I think the best solution is to not inline the function at all.  The
appended patch does this and now all tests pass with the new inliner.

Ok to commit?

Andreas

2003-11-30  Andreas Jaeger  <aj@suse.de>

	* stdio-common/vfprintf.c: Do not inline buffered_vfprintf to
	decrease stack usage.

============================================================
Index: stdio-common/vfprintf.c
--- stdio-common/vfprintf.c	6 Sep 2003 07:50:03 -0000	1.123
+++ stdio-common/vfprintf.c	30 Nov 2003 17:51:26 -0000
@@ -209,7 +209,7 @@ static const CHAR_T null[] = L_("(null)"
 
 /* Helper function to provide temporary buffering for unbuffered streams.  */
 static int buffered_vfprintf __P ((FILE *stream, const CHAR_T *fmt, va_list))
-     internal_function;
+     __attribute__ ((noinline)) internal_function;
 
 /* Handle unknown format specifier.  */
 static int printf_unknown __P ((FILE *, const struct printf_info *,

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgp00000.pgp
Description: PGP signature


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