From patchwork Tue Apr 17 16:52:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Kosnik X-Patchwork-Id: 153253 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 C1727B6FEC for ; Wed, 18 Apr 2012 02:53:46 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1335286427; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:From:To:Subject:Message-ID:Mime-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=+37GPe2pK4YwrB90F5R6 4OrGUc4=; b=xTJkvh3ho+MV+1laYxqUe8eqw6gR4BbEJteKyPWowVj3m2ENy8MA p+PFGsuz1pIsXzEyQpXV36shfaqjaS3sr2cEwO1DMFIJsiwrsEH/o2O1XmDJdwOb a4F4ayGCBkS4gQRXQhKNPCKjUhZSv4caQiQfDJCL4T6TK0OFX3xB218= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Date:From:To:Subject:Message-ID:Mime-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=fCLBxN09+CFaq3Cc32227nq73AUfMISALjkJqEotqdZR2i897umayQ4RVFVVxv SaaJKdHXSPlFJr+j83A301TTx/VMmEXIqouwX3KkEf4wxGssdqghiFForlEYi4/3 ekJ7tpn2A+klTtF3IfcQ+mgbtSEerZThBcm0eLxt8XZx4=; Received: (qmail 11238 invoked by alias); 17 Apr 2012 16:53:03 -0000 Received: (qmail 11135 invoked by uid 22791); 17 Apr 2012 16:53:01 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, SPF_HELO_PASS, T_RP_MATCHES_RCVD, URI_HEX X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Apr 2012 16:52:21 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3HGqLef020934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 17 Apr 2012 12:52:21 -0400 Received: from adair (ovpn-113-87.phx2.redhat.com [10.3.113.87]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3HGqKO9023426; Tue, 17 Apr 2012 12:52:20 -0400 Date: Tue, 17 Apr 2012 09:52:30 -0700 From: Benjamin De Kosnik To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: [v3] std::uninitialized_copy test Message-ID: <20120417095230.6e9fc5ac@adair> Mime-Version: 1.0 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 Found this bug in 4.4 branches, fixed with the following in later branches: http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01616.html But the test case is useful anyway. tested x86/linux -benjamin 2012-04-16 Benjamin Kosnik * testsuite/20_util/specialized_algorithms/uninitialized_copy/ 808590.cc: New. diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc new file mode 100644 index 0000000..7ccd8da --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc @@ -0,0 +1,48 @@ +// Copyright (C) 2012 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 Pred 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 +// . + +#include +#include + +// 4.4.x only +struct c +{ + void *m; + + c(void* o = 0) : m(o) {} + c(const c &r) : m(r.m) {} + + template + explicit c(T &o) : m((void*)0xdeadfbeef) { } +}; + +int main() +{ + std::vector cbs; + const c cb((void*)0xcafebabe); + + for (int fd = 62; fd < 67; ++fd) + { + cbs.resize(fd + 1); + cbs[fd] = cb; + } + + for (int fd = 62; fd< 67; ++fd) + if (cb.m != cbs[fd].m) + throw std::runtime_error("wrong"); + return 0; +}