[lld] r233088 - [Mips] Suppress "right shift by too large amount" warning

Simon Atanasyan simon at atanasyan.com
Wed Mar 25 11:14:55 PDT 2015


On Wed, Mar 25, 2015 at 9:02 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
> On Wed, Mar 25, 2015 at 10:55 AM, Simon Atanasyan <simon at atanasyan.com>
> wrote:
>>
>> On Wed, Mar 25, 2015 at 8:42 PM, David Blaikie <dblaikie at gmail.com> wrote:
>> >
>> > On Wed, Mar 25, 2015 at 10:38 AM, Simon Atanasyan <simon at atanasyan.com>
>> > wrote:
>> >>
>> >> By the way, what do you suggest to silence the VC++ warning?
>> >
>> > Disabling the warning, this is a false positive because some
>> > instantiations
>> > of the template produce non-zero results out of this shift and the fact
>> > that
>> > some other instantiations always produce 0 is fine. Same goes for
>> > template-conditionally dead code, etc.
>>
>> In fact I am satisfied by the current code as well as by you
>> suggestion. The only problem - I do not have access to VC++ so cannot
>> surround the code by appropriate warning disabling pragmas and check
>> that they work.
>
>
> Nah, I'm suggesting a somewhat more aggressive patth forward: disable the
> warning entirely for the LLVM build. Andy Kaylor recently submitted a patch
> to disable a bunch of noisy MSVC warnings & I'd suggest we just add this one
> to the list.

Hmm, but what about a non-template code like below? In this case the
warning can help to detect the problem. No?

uint8_t getData();

uint32_t foo() {
  // for example, initially getData() returned uint32_t,
  // or 8 is a typo and should be 7, etc
  return getData() << 8;
}

-- 
Simon Atanasyan



More information about the llvm-commits mailing list