Do not inline buffered_vfprintf
Andreas Jaeger
aj@suse.de
Sun Nov 30 19:15:00 GMT 2003
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-hacker/attachments/20031130/5ebcd997/attachment.sig>
More information about the Libc-hacker
mailing list