From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16296 invoked by alias); 23 Sep 2013 16:02:08 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 16273 invoked by uid 89); 23 Sep 2013 16:02:08 -0000 Received: from mail-ye0-f178.google.com (HELO mail-ye0-f178.google.com) (209.85.213.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 23 Sep 2013 16:02:08 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: mail-ye0-f178.google.com Received: by mail-ye0-f178.google.com with SMTP id m5so1233413yen.37 for ; Mon, 23 Sep 2013 09:02:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=4/HgvdI29S7vhunhSHDT8Qj6pOTST+bn3/FrSmlFVMc=; b=W1bn/iRhlAI2RIV9vMqeXW2o/wC0/VZUNhKlJ/YQGyBQqXqaOqO26jE3cV+KCLC7nY Q5ofI59pqy7/8l6BnrGQ3wZWjHEaVuju12k38VawivVGB1wK2Kr8Da1Ul7KIRgwClJs1 HJMjD882n8CJskK9MwEIMMnx1yOkQhBY+qVGwsipC6vHZ7wtNwSDB7RAh6s96L2QKZuu 7bhLlAHPjdOnlRBzNbkJ7TKx3ASdXwCgm4m142ZiqYicAmKpVQ1WaVlE9lyimiPS5XFc awd4fqLAT0zll0he05tSpPoEAMkyH7hDkvdDLzO1vPlEtCOWZgN2T3ZE1RBli+GAtQ++ 9Nvg== X-Gm-Message-State: ALoCoQnh59WL0DIcx30YpJgyEBYx53EmQZntbLLnOjSW9xHvLDHac0j2kOF2oK5rh7GDXzPmZAQTLgpybNeFJevo37AHQTg1mLRGIGOr3PgwcWcsCJ0bhCkceLVfGy3WtRD7NHyOLzWPiEiUr4tVVoZBf0uaTN7auTdoiFu69NMc1lCc56izWV38jS1QIp2VaJV1/OvQ+53A/yI24eKQnJtQiQHE62zFPg== X-Received: by 10.236.121.144 with SMTP id r16mr1436977yhh.64.1379952125955; Mon, 23 Sep 2013 09:02:05 -0700 (PDT) Received: from elbrus-m2.roam.corp.google.com ([172.16.55.142]) by mx.google.com with ESMTPSA id m68sm37034054yhj.22.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Sep 2013 09:02:04 -0700 (PDT) Message-ID: <524065FA.2020301@google.com> Date: Mon, 23 Sep 2013 16:38:00 -0000 From: Paul Pluzhnikov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Paolo Carlini CC: Andreas Schwab , =?ISO-8859-1?Q?Daniel_Kr=FCgler?= , gcc-patches List , libstdc++ Subject: Re: [patch] Make vector::at() assertion message more useful (try #2) References: <5232E2AF.4000106@oracle.com> <52402567.2080407@oracle.com> <524054C8.3010502@google.com> <52405639.8030306@oracle.com> In-Reply-To: <52405639.8030306@oracle.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-09/txt/msg01688.txt.bz2 On 9/23/13 7:54 AM, Paolo Carlini wrote: >> Testing this patch: > In fact, however, that unsigned long long instantiation isn't > *unconditionally* available, see locale-inst.cc. Thanks, > I think we have to use > unsigned long as a fall back controlled by the same macro. And please > add a comment explaining those contortions having to do with the > available instantiations. Patch pre-approved. Does this look right? 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. +#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(__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)