From patchwork Sat Sep 18 01:30:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 65119 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]) by ozlabs.org (Postfix) with SMTP id 5FFB3B6EFE for ; Sat, 18 Sep 2010 11:30:50 +1000 (EST) Received: (qmail 25977 invoked by alias); 18 Sep 2010 01:30:47 -0000 Received: (qmail 25962 invoked by uid 22791); 18 Sep 2010 01:30:46 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, TW_XF X-Spam-Check-By: sourceware.org Received: from vsmtp2.tin.it (HELO vsmtp2.tin.it) (212.216.176.222) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 18 Sep 2010 01:30:41 +0000 Received: from [192.168.0.4] (79.36.30.117) by vsmtp2.tin.it (8.0.022) id 49F5BE4228ED0BAC; Sat, 18 Sep 2010 03:30:38 +0200 Message-ID: <4C94163E.10000@oracle.com> Date: Sat, 18 Sep 2010 03:30:38 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100714 SUSE/3.0.6 Thunderbird/3.0.6 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] libstdc++/45713 X-IsSubscribed: yes 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 Hi, tested x86_64-linux multilib, committed to mainline. Paolo. ///////////////////////// 2010-09-17 Luc Hermitte Paolo Carlini PR libstdc++/45713 * include/std/bitset: Fix _GLIBCXX_BITSET_WORDS macro. * testsuite/23_containers/bitset/45713.cc: New. Index: include/std/bitset =================================================================== --- include/std/bitset (revision 164368) +++ include/std/bitset (working copy) @@ -53,8 +53,8 @@ #define _GLIBCXX_BITSET_BITS_PER_WORD (__CHAR_BIT__ * sizeof(unsigned long)) #define _GLIBCXX_BITSET_WORDS(__n) \ - ((__n) < 1 ? 0 : ((__n) + _GLIBCXX_BITSET_BITS_PER_WORD - 1) \ - / _GLIBCXX_BITSET_BITS_PER_WORD) + ((__n) / _GLIBCXX_BITSET_BITS_PER_WORD + \ + ((__n) % _GLIBCXX_BITSET_BITS_PER_WORD == 0 ? 0 : 1)) _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) Index: testsuite/23_containers/bitset/45713.cc =================================================================== --- testsuite/23_containers/bitset/45713.cc (revision 0) +++ testsuite/23_containers/bitset/45713.cc (revision 0) @@ -0,0 +1,25 @@ +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-do compile } + +#include + +// libstdc++/45713 +#if __SIZEOF_SIZE_T__ >= 4 +int test[sizeof(std::bitset<0xffffffff>) != 1 ? 1 : -1]; +#endif