On Jul 1, 2013, at 9:15 AM, Marshall Clow <[email protected]> wrote:

> On Jun 29, 2013, at 11:38 AM, Howard Hinnant <[email protected]> wrote:
> 
>> +inline _LIBCPP_INLINE_VISIBILITY
>> +_LIBCPP_CONSTEXPR
>> +launch
>> +operator~(launch __x)
>> +{
>> +    return static_cast<launch>(~static_cast<__launch_underlying_type>(__x));
>> +}
> 
> This may cause problems down the line, because it sets bits in launch that 
> are not defined to have any meaning.
> I ran into this kind of stuff when trying to use UBSan.
> 
> To prevent this problem, you can AND the result with 3, clearing all the 
> unused bits.
> 
>> +    return static_cast<launch>(~static_cast<__launch_underlying_type>(__x) 
>> & 3);
> 
> (Yeah, I hate the naked '3' there too.)
> 
> -- Marshall
> 
> Marshall Clow     Idio Software   <mailto:[email protected]>
> 
> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is 
> promptly moderated down to (-1, Flamebait).
>        -- Yu Suzuki
> 

Thanks!

Committed revision 185452.

Howard

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to