From patchwork Mon Sep 19 22:04:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 671974 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 3sdKgZ0HNtz9s4x for ; Tue, 20 Sep 2016 08:04:57 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=yn9U2zlK; 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=QWTnWkAFkMW6L80Pr3p1NbTUpnJed 4iV2xxIqb6pu7T0krGrtMJsVdTXCtknJ7b1QGabtmG0zlJz8a7sHntc1LtwVxET+ 4420WgmkWhX/xvghNmyx5rhY29Z7dECoEGwUBOPuCL2pJJ0tX1Dx5wYedtWcA/kT kU16aXAQXxCbYY= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=uQx92wj8ic2foOgTt72ZGqwO6fM=; b=yn9 U2zlK9sdG4b4dx8z+naDwzk1Ge2cl41BmtWqPFnAUZ9FAnpBQchDRmEcwRZ0UrMa bIqDah4NvIqv9E+ssqTIvJwwDqe7tQmU5R1l32eLIs4L/elYOP1DjIS0VBiklOHN AJ4/nWY9e/+lJ6P/LeZGowiSZRmEAkEWttKZNoXQ= Received: (qmail 66473 invoked by alias); 19 Sep 2016 22:04:45 -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 66455 invoked by uid 89); 19 Sep 2016 22:04:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:835 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Sep 2016 22:04:34 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A5FEC0528C0 for ; Mon, 19 Sep 2016 22:04:33 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-204-43.brq.redhat.com [10.40.204.43]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8JM4W0B011411 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 19 Sep 2016 18:04:33 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u8JM4UdY017013; Tue, 20 Sep 2016 00:04:31 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u8JM4Uv1017012; Tue, 20 Sep 2016 00:04:30 +0200 Date: Tue, 20 Sep 2016 00:04:30 +0200 From: Jakub Jelinek To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: [C++ PATCH] Fix C++ violation in g++.jason/init3.C (PR testsuite/63299) Message-ID: <20160919220430.GT7282@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Hi! As valgrind reports, this testcase allocates the string with new [], but deallocates with delete str. Fixed thusly, regtested on x86_64-linux and i686-linux, ok for trunk? 2016-09-19 Maxim Ostapenko Jakub Jelinek PR testsuite/63299 * g++.old-deja/g++.jason/init3.C (My_string::~My_string): Use delete[] instead of delete. Jakub --- gcc/testsuite/g++.old-deja/g++.jason/init3.C.jj 2008-09-05 12:54:52.000000000 +0200 +++ gcc/testsuite/g++.old-deja/g++.jason/init3.C 2016-09-19 16:06:01.328022761 +0200 @@ -10,7 +10,7 @@ class My_string { public: My_string(const char* string); My_string(const My_string &); - ~My_string() { delete str; } + ~My_string() { delete [] str; } char* char_p() { return str; } };