From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [patch] libstdc++/65352 fix ubsan errors in std::array<T, 0>
Date: Thu, 28 May 2015 13:57:00 -0000 [thread overview]
Message-ID: <20150528134042.GQ2985@redhat.com> (raw)
In-Reply-To: <20150528133817.GP2985@redhat.com>
On 28/05/15 14:38 +0100, Jonathan Wakely wrote:
>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<T, 0> 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<T, 0>.
Would there be a danger of an object compiled with gcc-5.1 that calls
array<T, 0>::data() finding the _S_ref from an object compiled with
gcc-5.2 and hitting the __builtin_unreachable in vali code?
next prev parent reply other threads:[~2015-05-28 13:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 12:03 Jonathan Wakely
2015-05-28 12:37 ` Jonathan Wakely
2015-05-28 13:38 ` Marc Glisse
2015-05-28 13:52 ` Jonathan Wakely
2015-05-28 13:57 ` Jonathan Wakely [this message]
2015-05-28 14:06 ` Marc Glisse
2015-05-28 14:49 ` Jonathan Wakely
2015-05-28 15:08 ` Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150528134042.GQ2985@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).