[llvm-commits] [LLVMbugs] [Bug 7322] ms vcpp build warnings
Chris Lattner
clattner at apple.com
Tue Jun 15 13:56:15 PDT 2010
On Jun 15, 2010, at 12:45 PM, nate begeman wrote:
> Sure, sorry, I seemed to recall shifts implicitly promoting to int, but maybe that's in C and not C++, will cast.
They do promote to int, it just causes warnings with some compilers.
-Chris
>
> Nate
>
> On Jun 15, 2010, at 12:05 PM, Chris Lattner wrote:
>
>> Nate, can you change these to use "nElts << (int)quad" or something?
>>
>> -Chris
>>
>> On Jun 15, 2010, at 7:43 AM, Dimitry Andric wrote:
>>
>>> 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?
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
More information about the llvm-commits
mailing list