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
jos...@codesourcery.com

Reply via email to