This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Ubsan load of bool/enum sanitization
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jeff Law <law at redhat dot com>, Marek Polacek <polacek at redhat dot com>, <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 18 Dec 2013 17:56:51 +0000
- Subject: Re: [PATCH] Ubsan load of bool/enum sanitization
- Authentication-results: sourceware.org; auth=none
- References: <20131214195352 dot GF892 at tucnak dot redhat dot com> <52AF459D dot 30908 at redhat dot com> <20131216184016 dot GT892 at tucnak dot redhat dot com>
On Mon, 16 Dec 2013, Jakub Jelinek wrote:
> It can be the last thing, sure. I think the still unimplemented and
> potentially useful are the floating point overflow sanitization (haven't
> looked yet what exactly it is, I suppose casts from floating point to
> integers where the values are out of range, but dunno exactly) and
Note that under Annex F that's only unspecified value plus "invalid"
exception, rather than undefined behavior (though that issue is covered by
allowing this checking to be enabled / disabled independent of the other
cases). (Reliably getting the "invalid" exception is one of the many
Annex F pieces not implemented in GCC.)
I think it would be most appropriate for floating-point conversion to
bit-fields in C to count as out of range (with sanitization / exception as
appropriate) based on the range of the bit-field, but in C++ it should
probably be based on the range of the underlying type not taking into
account the bit-field width, with conversion from that type to the
bit-field then being modulo, in accordance with the principle that
bit-field width is not part of the type in C++.
--
Joseph S. Myers
joseph@codesourcery.com