From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113782 invoked by alias); 28 May 2015 13:38:23 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 113762 invoked by uid 89); 28 May 2015 13:38:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_05,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 28 May 2015 13:38:21 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 7371AC1F69; Thu, 28 May 2015 13:38:20 +0000 (UTC) Received: from localhost (ovpn-116-76.ams2.redhat.com [10.36.116.76]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4SDcJGK003765; Thu, 28 May 2015 09:38:19 -0400 Date: Thu, 28 May 2015 13:52:00 -0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org Subject: Re: [patch] libstdc++/65352 fix ubsan errors in std::array Message-ID: <20150528133817.GP2985@redhat.com> References: <20150528115330.GL2985@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-05/txt/msg02643.txt.bz2 On 28/05/15 15:26 +0200, Marc Glisse wrote: >On Thu, 28 May 2015, Jonathan Wakely wrote: > >>Unsurprisingly ubsan doesn't like referencing a null pointer. >> >>With this change __array_traits::_S_ref is only used to access an >>element, which is invalid for std::array anyway. > >Should > >return *static_cast<_Tp*>(nullptr); > >be replaced with > >__builtin_unreachable(); > >then? It seems strange to keep an implementation that is never >supposed to be used. That's a good idea, I experimented with just not defining it but that fails for explicit instantiations of array.