<div dir="ltr">Yeah, it looks to me that it's always 0, too if the return type of getType is unsigned char.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 24, 2015 at 9:22 AM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Mar 24, 2015 at 12:16 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
><br>
> On Tue, Mar 24, 2015 at 8:49 AM, Simon Atanasyan <<a href="mailto:simon@atanasyan.com">simon@atanasyan.com</a>><br>
> wrote:<br>
>><br>
>> Author: atanasyan<br>
>> Date: Tue Mar 24 10:49:59 2015<br>
>> New Revision: 233088<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=233088&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=233088&view=rev</a><br>
>> Log:<br>
>> [Mips] Suppress "right shift by too large amount" warning<br>
>><br>
>> Visual C++ shows the "right shift by too large amount" warning if<br>
>> `MipsELFReference` is instantiated for 32-bit target and<br>
>> `Elf_Rel_Impl::getType`<br>
>> method has `unsigned char` return type. We can freely suppress the warning<br>
>> in<br>
>> that case because MIPS 32-bit ABI does not pack multiple relocation types<br>
>> into<br>
>> the single field `r_type` and the `MipsELFReference::_tag` should be<br>
>> always<br>
>> zero in that case.<br>
><br>
><br>
> Can we just disable the MSVC warning if it's wrong, then?<br>
<br>
</span>IMO, the MSVC warning was correct (the original code was right<br>
shifting all significant bits away) and should not be disabled.<br>
<span class="HOEnZb"><font color="#888888"><br>
~Aaron<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
>><br>
>><br>
>> No functional changes.<br>
>><br>
>> Modified:<br>
>> lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h<br>
>><br>
>> Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h?rev=233088&r1=233087&r2=233088&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h?rev=233088&r1=233087&r2=233088&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h (original)<br>
>> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h Tue Mar 24 10:49:59<br>
>> 2015<br>
>> @@ -101,13 +101,13 @@ public:<br>
>> : ELFReference<ELFT>(<br>
>> &rel, rel.r_offset - symValue, Reference::KindArch::Mips,<br>
>> rel.getType(_isMips64EL) & 0xff, rel.getSymbol(_isMips64EL)),<br>
>> - _tag(rel.getType(_isMips64EL) >> 8) {}<br>
>> + _tag(uint32_t(rel.getType(_isMips64EL)) >> 8) {}<br>
>><br>
>> MipsELFReference(uint64_t symValue, const Elf_Rel &rel)<br>
>> : ELFReference<ELFT>(rel.r_offset - symValue,<br>
>> Reference::KindArch::Mips,<br>
>> rel.getType(_isMips64EL) & 0xff,<br>
>> rel.getSymbol(_isMips64EL)),<br>
>> - _tag(rel.getType(_isMips64EL) >> 8) {}<br>
>> + _tag(uint32_t(rel.getType(_isMips64EL)) >> 8) {}<br>
>><br>
>> uint32_t tag() const override { return _tag; }<br>
>> void setTag(uint32_t tag) { _tag = tag; }<br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>