This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Make vector::at() assertion message more useful (try #2)
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: Andreas Schwab <schwab at suse dot de>, Daniel Krügler <daniel dot kruegler at gmail dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>, libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 23 Sep 2013 09:38:23 -0700
- Subject: Re: [patch] Make vector::at() assertion message more useful (try #2)
- Authentication-results: sourceware.org; auth=none
- References: <ye6qhae0qpf8 dot fsf at elbrus2 dot mtv dot corp dot google dot com> <CAGNvRgDfHf6pYmBYC66HHhj6RobhiaiAAVEKj1FDxSWGxbYFTg at mail dot gmail dot com> <CALoOobMf3u8R_DVW5b2eRy05fBpB5unhriLMYdUEkT_E3DwtaA at mail dot gmail dot com> <CAGNvRgD6mK=-n7QhK=-NtfXZHOpCniXKc-riWUNfqZeVa8xufQ at mail dot gmail dot com> <CALoOobO6XEsrSM6jJFCQ=n00iY8qM=eujs-=LixNZyuya5f-cA at mail dot gmail dot com> <5232E2AF dot 4000106 at oracle dot com> <CALoOobMejGJLVVCszP8Joa+4B21UbvK4chyFUnjiCNPP0GJF0A at mail dot gmail dot com> <mvma9j35377 dot fsf at hawking dot suse dot de> <52402567 dot 2080407 at oracle dot com> <524054C8 dot 3010502 at google dot com> <52405639 dot 8030306 at oracle dot com> <524065FA dot 2020301 at google dot com> <52406B4B dot 1070507 at oracle dot com>
On 9/23/13 9:24 AM, Paolo Carlini wrote:
Does this look right?
Yes. Nit, in the comment I would also explicitly mention locale-inst.cc.
Done, submitted as r202836.
2013-09-23 Paul Pluzhnikov <ppluzhnikov@google.com>
* src/c++11/snprintf_lite.cc (__concat_size_t): Use
unsigned long long conditionally.
Index: libstdc++-v3/src/c++11/snprintf_lite.cc
===================================================================
--- libstdc++-v3/src/c++11/snprintf_lite.cc (revision 202832)
+++ libstdc++-v3/src/c++11/snprintf_lite.cc (working copy)
@@ -69,11 +69,17 @@
// Returns number of characters appended, or -1 if BUFSIZE is too small.
int __concat_size_t(char *__buf, size_t __bufsize, size_t __val)
{
+ // __int_to_char is explicitly instantiated and available only for
+ // some, but not all, types. See locale-inst.cc.
+#ifdef _GLIBCXX_USE_LONG_LONG
+ unsigned long long __val2 = __val;
+#else
+ unsigned long __val2 = __val;
+#endif
// Long enough for decimal representation.
- unsigned long long __val_ull = __val;
- int __ilen = 3 * sizeof(__val_ull);
+ int __ilen = 3 * sizeof(__val2);
char *__cs = static_cast<char*>(__builtin_alloca(__ilen));
- size_t __len = std::__int_to_char(__cs + __ilen, __val_ull,
+ size_t __len = std::__int_to_char(__cs + __ilen, __val2,
std::__num_base::_S_atoms_out,
std::ios_base::dec, true);
if (__bufsize < __len)