From patchwork Mon Nov 25 10:36:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 293882 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6D17E2C0098 for ; Mon, 25 Nov 2013 21:37:00 +1100 (EST) 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:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=p1s57n/aCN4+NWlZ+ Pe1xlDuHEvdGN2M2mDODI3vwsUY+/UYDcqJlpTn0pijYHO74BAtLIBXfEtbGa3eS QRtIwCmqkFDnLtedlmHW9kl0TMqB33rCtf2fNnmtLjCzFE1ryPi7CjRxdiB/2bJ8 eE45dCql0X64RC0e80J68MSfL8= 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:references:mime-version :content-type:in-reply-to; s=default; bh=LJoC9Nq+BWIyohUmRTF/IGw R2RI=; b=KH2l398xrZRfMFSKseHKRGpchHFeFXcAv8rTZHBxbApxZHecfBgvdPt 7g+IEepyArqe6dhR1NfgWuKS9CqPX3dyJW0hjxessGxvvnh4IJUoE1qTuDWx9dtn j5/hSJ7Cfnocrm6H1QL+5YymXoJUGO/oUWLNTCUBCLatomAWH4hg= Received: (qmail 8481 invoked by alias); 25 Nov 2013 10:36:50 -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 8471 invoked by uid 89); 25 Nov 2013 10:36:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_50, RDNS_NONE, SPF_HELO_PASS, SPF_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 25 Nov 2013 10:36:48 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAPAafuA006831 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 25 Nov 2013 05:36:41 -0500 Received: from redhat.com (ovpn-116-18.ams2.redhat.com [10.36.116.18]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rAPAabhc024167 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 25 Nov 2013 05:36:40 -0500 Date: Mon, 25 Nov 2013 11:36:37 +0100 From: Marek Polacek To: Jakub Jelinek Cc: GCC Patches Subject: Re: [PATCH] Add testcase for PR59250 Message-ID: <20131125103637.GN30062@redhat.com> References: <20131125094457.GL30062@redhat.com> <20131125094956.GV892@tucnak.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20131125094956.GV892@tucnak.redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) On Mon, Nov 25, 2013 at 10:49:56AM +0100, Jakub Jelinek wrote: > On Mon, Nov 25, 2013 at 10:44:57AM +0100, Marek Polacek wrote: > > The PR was fixed by Jakub in r205283, this patch merely adds a > > testcase for it. Passed ubsan testsuite for -m32/-m64. > > > > Ok for trunk? > > Can't you reduce it at least a little bit more? > Like I doubt __attribute__ ((__visibility__ ("default"))) > is needed to reproduce, I'd also think you could get rid of the namespaces, > perhaps also const _Alloc& __a = _Alloc() argument? Ok, I've played a little bit with it and reduced it down to the following. Ok now? 2013-11-25 Marek Polacek testsuite/ * g++.dg/ubsan/pr59250.C: New test. Marek --- gcc/testsuite/g++.dg/ubsan/pr59250.C.mp3 2013-11-25 10:43:24.797315678 +0100 +++ gcc/testsuite/g++.dg/ubsan/pr59250.C 2013-11-25 11:33:56.817539980 +0100 @@ -0,0 +1,18 @@ +// PR sanitizer/59250 +// { dg-do compile } +// { dg-options "-fsanitize=undefined" } +// { dg-skip-if "" { *-*-* } { "-flto" } { "" } } + +struct S { + const char *s; + S (const char *); +}; + +struct E { + int i; +}; + +S::S (const char *) : s (0) +{ + new E (); +}