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

David Blaikie dblaikie at gmail.com
Wed Mar 25 11:27:18 PDT 2015


On Wed, Mar 25, 2015 at 11:14 AM, Simon Atanasyan <simon at atanasyan.com>
wrote:

> 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?
>

It can, but it doesn't sound like we've really had a problem with bugs like
this (though I wouldn't object to someone implementing the warning
correctly in clang & us using it - it doesn't seem to be a priority).

It's certainly possible people are writing such bugs, finding them in
testing, and not many manage to survive in the codebase long enough to have
reached the cleanup Andy was doing (or even to reach the MSVC warning/be
cleaned up previously - I don't recall seeing this warning cropping
up/being fixed previously, but it's certainly possible) and that the
warning would help catch it earlier & save someone some debugging time.

- David


>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150325/56574a7a/attachment.html>


More information about the llvm-commits mailing list