Make vector::at() assertion message more useful (try #2)

Submitted by Paul Pluzhnikov on Sept. 23, 2013, 3:29 p.m.

Details

Message ID 52405E64.7060002@google.com
State New
Headers show

Commit Message

Paul Pluzhnikov Sept. 23, 2013, 3:29 p.m.
On 9/23/13 7:48 AM, Paul Pluzhnikov wrote:

> Testing this patch:

libstdc++ tests finished with
RUNTESTFLAGS='--target_board=unix\{-m32,-m64\}'

Committed as r202832.

Sorry about the trouble.
--


2013-09-23  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* src/c++11/snprintf_lite.cc (__concat_size_t): Use only
	std::__int_to_char<unsigned long long>()

Patch hide | download patch | download mbox

Index: libstdc++-v3/src/c++11/snprintf_lite.cc
===================================================================
--- libstdc++-v3/src/c++11/snprintf_lite.cc	(revision 202830)
+++ libstdc++-v3/src/c++11/snprintf_lite.cc	(working copy)
@@ -70,9 +70,10 @@ 
    int __concat_size_t(char *__buf, size_t __bufsize, size_t __val)
    {
      // Long enough for decimal representation.
-    int __ilen = 3 * sizeof(__val);
+    unsigned long long __val_ull = __val;
+    int __ilen = 3 * sizeof(__val_ull);
      char *__cs = static_cast<char*>(__builtin_alloca(__ilen));
-    size_t __len = std::__int_to_char(__cs + __ilen, __val,
+    size_t __len = std::__int_to_char(__cs + __ilen, __val_ull,
  				      std::__num_base::_S_atoms_out,
  				      std::ios_base::dec, true);
      if (__bufsize < __len)