[compiler-rt] r337170 - [cfi] Don't pass a uint16_t to memset. Make sure the 16-bit constant is appropriate for us.
Filipe Cabecinhas via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 16 10:29:24 PDT 2018
Chandler fixed it ahead of me. Sorry for not monitoring this as I should.
Thank you,
Filipe
On Mon, 16 Jul 2018 at 18:08, Filipe Cabecinhas <filcab at filcab.net> wrote:
> Sorry. Fixing!
>
> Filipe
>
> On Mon, 16 Jul 2018 at 14:57, Benjamin Kramer <benny.kra at gmail.com> wrote:
>
>>
>>
>> On Mon, Jul 16, 2018 at 3:46 PM Filipe Cabecinhas via llvm-commits <
>> llvm-commits at lists.llvm.org> wrote:
>>
>>> Author: filcab
>>> Date: Mon Jul 16 06:41:54 2018
>>> New Revision: 337170
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=337170&view=rev
>>> Log:
>>> [cfi] Don't pass a uint16_t to memset. Make sure the 16-bit constant is
>>> appropriate for us.
>>>
>>> Reviewers: eugenis, pcc, kcc
>>>
>>> Subscribers: delcypher, #sanitizers, llvm-commits
>>>
>>> Differential Revision: https://reviews.llvm.org/D49252
>>>
>>> Modified:
>>> compiler-rt/trunk/lib/cfi/cfi.cc
>>>
>>> Modified: compiler-rt/trunk/lib/cfi/cfi.cc
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/cfi/cfi.cc?rev=337170&r1=337169&r2=337170&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/lib/cfi/cfi.cc (original)
>>> +++ compiler-rt/trunk/lib/cfi/cfi.cc Mon Jul 16 06:41:54 2018
>>> @@ -132,7 +132,10 @@ void ShadowBuilder::Start() {
>>> void ShadowBuilder::AddUnchecked(uptr begin, uptr end) {
>>> uint16_t *shadow_begin = MemToShadow(begin, shadow_);
>>> uint16_t *shadow_end = MemToShadow(end - 1, shadow_) + 1;
>>> - memset(shadow_begin, kUncheckedShadow,
>>> + // memset takes a byte, so our unchecked shadow value requires both
>>> bytes to
>>> + // be the same. Make sure we're ok during compilation.
>>> + static_assert(kUncheckedShadow & 0xff == ((kUncheckedShadow >> 8) &
>>> 0xff));
>>>
>>
>> llvm/projects/compiler-rt/lib/cfi/cfi.cc:137:34: error: & has lower
>> precedence than ==; == will be evaluated first [-Werror,-Wparentheses]
>> static_assert(kUncheckedShadow & 0xff == ((kUncheckedShadow >> 8) &
>> 0xff));
>>
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> llvm/projects/compiler-rt/lib/cfi/cfi.cc:137:34: note: place parentheses
>> around the '==' expression to silence this warning
>> static_assert(kUncheckedShadow & 0xff == ((kUncheckedShadow >> 8) &
>> 0xff));
>> ^
>> (
>> )
>> llvm/projects/compiler-rt/lib/cfi/cfi.cc:137:34: note: place parentheses
>> around the & expression to evaluate it first
>> static_assert(kUncheckedShadow & 0xff == ((kUncheckedShadow >> 8) &
>> 0xff));
>> ^
>> ( )
>> llvm/projects/compiler-rt/lib/cfi/cfi.cc:137:76: error: static_assert
>> with no message is a C++17 extension [-Werror,-Wc++17-extensions]
>> static_assert(kUncheckedShadow & 0xff == ((kUncheckedShadow >> 8) &
>> 0xff));
>>
>> ^
>>
>> , ""
>>
>>
>>> + memset(shadow_begin, kUncheckedShadow & 0xff,
>>> (shadow_end - shadow_begin) * sizeof(*shadow_begin));
>>> }
>>>
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180716/7f1866f8/attachment.html>
More information about the llvm-commits
mailing list