[llvm-commits] [LLVMbugs] [Bug 7322] ms vcpp build warnings

Dimitry Andric dimitry at andric.com
Tue Jun 15 07:43:44 PDT 2010


On 2010-06-14 22:39, bugzilla-daemon at llvm.org wrote:
> --- Comment #1 from Chris Lattner <clattner at apple.com> 2010-06-14 15:39:27 CDT ---
> there are a bunch of build warnings with MSVC.  If you're interested in helping
> with this, please send patches to llvm-commits, thanks!

What I see quite often with VC++ is this warning:

.\NeonEmitter.cpp(529) : warning C4804: '<<' : unsafe use of type 'bool' in operation

which comes from bool variables used as shift count, e.g:

  bool dummy, quad = false;
...
    b = Duplicate(nElts << quad, typestr, "b");

I'm not sure if this is unnecessarily paranoid of VC++, as the standard
seems to imply it should be no problem, if I read it correctly:

[conv.prom]
4. An rvalue of type bool can be converted to an rvalue of type int,
   with false becoming zero and true becoming one.

and [conv.integral]:

4. If the destination type is bool, see 4.12. If the source type is
   bool, the value false is converted to zero and the value true is
   converted to one.

In short, is it worthwhile to appease VC++ here, by using an int or
unsigned instead, or should we just stash in a pragma to disable this
particular warning?



More information about the llvm-commits mailing list