This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] sext_hwi: Avoid left shift of negative value undefined behaviour


On Aug 12, 2015, at 11:07 AM, Jeff Law <law@redhat.com> wrote:
> On 08/12/2015 11:12 AM, Richard Biener wrote:
>> 
>> Prec is almost never a constant and is heavily used from wide-int.
>> 
>> We are not exploiting this undefined ness in C so I object to making this so much slower.
>> 
>> Can we instead do what we do for abs_hwi and add a checking assert so we can move the tests to the callers that misbehave instead?
> Given that ISO C++ is moving away from making shifting 1 into the sign bit undefined behaviour, maybe we should make UBSan less strict in its warning.  That may eliminate the need for Mikael's patch.

Pedantically, then, we have to move the the later language standard (if this was standardese).  If it was DRese, then we’re safe.  :-)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]