On 03/02/17 19:02 +0000, Jonathan Wakely wrote:
Move explicit instantiation definitions for string I/O functions into
their own files so that iostream and locale definitions are not needed
for uses of strings without I/O. Move functions for throwing C++11
exceptions into the individual files defining the exception types, so
that using any of the functions from functexcept.cc doesn't pull in
large pieces of the C++11 library. Finally, avoid using __int_to_char in
snprintf_lite.cc to avoid pulling in locale-inst.cc for one function.

This fixes a bug in the __concat_size_t function, pointed out in the

Tested powerpc64le-linux, committed to trunk.

commit 3980cad61df5e51faff2f1edba151417838cc7ef
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Feb 16 12:06:28 2017 +0000

    PR libstdc++/60936 fix length calculation
    	PR libstdc++/60936
    	* src/c++11/snprintf_lite.cc (__concat_size_t): Calculate length
    	written to buffer, not length remaining in buffer.
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245505 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/libstdc++-v3/src/c++11/snprintf_lite.cc b/libstdc++-v3/src/c++11/snprintf_lite.cc
index 1a408ca..de132d9 100644
--- a/libstdc++-v3/src/c++11/snprintf_lite.cc
+++ b/libstdc++-v3/src/c++11/snprintf_lite.cc
@@ -81,7 +81,7 @@ namespace __gnu_cxx {
 	__val /= 10;
     while (__val != 0);
-    size_t __len = __out - __cs;
+    size_t __len = __cs + __ilen - __out;
     if (__bufsize < __len)
       return -1;

Reply via email to