From patchwork Fri Nov 13 18:40:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edelsohn X-Patchwork-Id: 544423 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A7DC414144F for ; Sat, 14 Nov 2015 05:41:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Qw/QIkpD; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=FbKiY4/ZX+VC4JZzMZ1q7/jiV3/pMdPT3NBnj2oT5fZ 0YzZCkOW1dG5ywDn6/ZFYuadD5qIjlwEfZWkFMgo29VP7098fA7h6VmC1hS6xPfX 7fQtc9OaVXuT+RcpqEVBgfqDB3woO4CR9sHT40OG/I2FCvkQAD5cXFK7h2FF5I84 = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=HAy85iDDhU5s8axVp4YGzY0FQhI=; b=Qw/QIkpDQ1Ln3ucAL tGZjOpCIyJNQsCfuDFhp4o3sJ6HEL7K2IrV5pMMxXsG7IQU/NIxLjmYJzmCTU9yi qANwkyMo8FbzY4Mu3PpVkje7kgJoCbTa0QUgucKm1/nmxtSUF/kjwAJUpqGpQGna rgeC7kmPhp1QaMrWTvrM1MuSLw= Received: (qmail 108172 invoked by alias); 13 Nov 2015 18:41:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 108155 invoked by uid 89); 13 Nov 2015 18:41:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-lf0-f41.google.com Received: from mail-lf0-f41.google.com (HELO mail-lf0-f41.google.com) (209.85.215.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 13 Nov 2015 18:40:55 +0000 Received: by lfs39 with SMTP id 39so57553530lfs.3 for ; Fri, 13 Nov 2015 10:40:52 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.25.18.209 with SMTP id 78mr10959552lfs.54.1447440051900; Fri, 13 Nov 2015 10:40:51 -0800 (PST) Received: by 10.114.71.114 with HTTP; Fri, 13 Nov 2015 10:40:51 -0800 (PST) Date: Fri, 13 Nov 2015 13:40:51 -0500 Message-ID: Subject: [PATCH] 21_strings/basic_string/capacity/wchar_t/18654.cc From: David Edelsohn To: Jonathan Wakely , Paolo Carlini Cc: GCC Patches http://www.cplusplus.com/reference/string/basic_string/reserve/ "Note that the resulting string capacity may be equal or greater than n." The current testcase verifies that the capacity is exactly equal to the length of the string or reserve value, but the standard allows the capacity to be larger. On AIX, the capacity is larger and the testcase incorrectly fails. Linux x86-64: i: 4 str.length: 4 str.capacity: 4 str.capacity: 12 str.capacity: 8 str.capacity: 4 AIX: i: 4 str.length: 4 str.capacity: 7 <-- i str.capacity: 14 <-- i*3 str.capacity: 8 <-- i*2 str.capacity: 7 <-- default * 21_strings/basic_string/capacity/wchar_t/18654.cc: Verify the capacity is greater than or equal to the requested amount. Thanks, David Index: 18654.cc =================================================================== --- 18654.cc (revision 230322) +++ 18654.cc (working copy) @@ -50,10 +50,10 @@ str.reserve(3 * i); str.reserve(2 * i); - VERIFY( str.capacity() == 2 * i ); + VERIFY( str.capacity() >= 2 * i ); str.reserve(); - VERIFY( str.capacity() == i ); + VERIFY( str.capacity() >= i ); } }