<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 9, 2016 at 3:47 PM, Joerg Sonnenberger via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</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, Feb 09, 2016 at 03:09:01PM -0800, Rui Ueyama wrote:<br>
> On Tue, Feb 9, 2016 at 3:03 PM, Joerg Sonnenberger via llvm-commits <<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
> > On Tue, Feb 09, 2016 at 02:40:06PM -0800, Rui Ueyama via llvm-commits<br>
> > wrote:<br>
> > > Tried to fix the warning, and I'm not now sure if the warning makes<br>
> > sense.<br>
> > > These "'~': zero extending '<smaller integer type>' to 'int64_t' of<br>
> > greater<br>
> > > size" warning may be annoying as it is issued for code like "int64_t x =<br>
> > > ~<some-int32_t-var>".<br>
> ><br>
> > This sounds like something were the semantic of the code is not<br>
> > obviously what was originally intended.<br>
> ><br>
><br>
> So you thought that was useful? Then why doesn't clang/gcc warn on that?<br>
<br>
</span>Good question :) I mean consider:<br>
<br>
int64_t x;<br>
...<br>
x &= ~7;<br>
<br>
was the intention here really to clear the upper half of x as well? Same<br>
question for a variable instead of 7.<br></blockquote><div><br></div><div>I understand the point. It also warned a case such that you have a function f(uint64_t) and a variable x uint32_t and call f(~x). It may be hard to identify that the upper 32 bits are filled with zeros from local context.</div><div><br></div><div>However, my question still stands. :)</div></div></div></div>