This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


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

Re: Bug in _VFPRINTF_R


According to Artur Lipowski on 10/13/2007 9:13 AM:
> 
> Probaly this patch is a cause of the error when using with specific
> build params.

Thanks for catching that, and sorry for not noticing it when I wrote it.
I'm installing this patch instead, since _MB_CABABLE is also affected:

2007-10-13  Eric Blake  <ebb9@byu.net>

	* libc/stdio/vfprintf.c (_VFPRINTF_R) [__OPTIMIZE_SIZE__]:
	Correctly nest else within conditionals.
	Reported by Artur Lipowski.

Index: libc/stdio/vfprintf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/vfprintf.c,v
retrieving revision 1.66
diff -u -p -r1.66 vfprintf.c
--- libc/stdio/vfprintf.c	17 Sep 2007 20:14:29 -0000	1.66
+++ libc/stdio/vfprintf.c	13 Oct 2007 15:24:27 -0000
@@ -1039,9 +1039,10 @@ reswitch:	switch (ch) {
 				cp = "(null)";
 				size = ((unsigned) prec > 6U) ? 6 : prec;
 			}
+			else
 #endif /* __OPTIMIZE_SIZE__ */
 #ifdef _MB_CAPABLE
-			else if (ch == 'S' || (flags & LONGINT)) {
+			if (ch == 'S' || (flags & LONGINT)) {
 				mbstate_t ps;
 				_CONST wchar_t *wcp;

@@ -1101,8 +1102,9 @@ reswitch:	switch (ch) {
 				}
 				cp[size] = '\0';
 			}
+			else
 #endif /* _MB_CAPABLE */
-			else if (prec >= 0) {
+			if (prec >= 0) {
 				/*
 				 * can't use strlen; can only look for the
 				 * NUL in the first `prec' characters, and

-- 
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net


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