This is an archive of the discontinued LLVM Phabricator instance.

Fix release_40 build with MSVC (VS 2015)
AbandonedPublic

Authored by yvvan on Jun 16 2017, 7:01 AM.

Details

Reviewers
hans
Summary

I currently have narrowing conversion error without that fix.
I try building with 64 and 32 bit compilers - both reproduce that error.

Diff Detail

Event Timeline

hans edited edge metadata.Jun 16 2017, 8:58 AM
hans added a subscriber: tstellar.

That's strange. I build the llvm 4.0 branch (and trunk too, which has the same code) with Visual Studio 2015 without problems. (I don't build with warnings as errors though, so if this is a warning maybe I missed it.) Do you have any local patches that might cause this problem?

In any case, I don't think Tom is taking more patches for the 4.0.1 release.

yvvan added a comment.Jun 16 2017, 9:45 AM

I also did not have any local patches applied - just checked out release_40 branch for llvm and clang.
I believe I also don't have warnings as errors enabled. At least I've checked for the extra flags and did not find such. I'll search once again if I have /WX somewhere in my build config.
But this patch should not break anything in any case.

I've checked once again. Werror is disabled and no /WX flag is used. So this is a compiler error in case of msvc even without these flags.

btw my cl version is 19.00.24215.1 (MS VS 2015 Update 3). Do you use the same one?

hans added a comment.Jun 19 2017, 8:17 AM

I have 19.00.24210, so slightly earlier I suppose, but I believe we use Update 3 on our Chromium buildbots, and they seem happy.

Can you paste the full error message? The part I see in your screenshot doesn't really make sense. Why should converting 1 to unsigned int be a narrowing conversion? I'm just trying to understand why we need this.

In D34279#784089, @hans wrote:

I have 19.00.24210, so slightly earlier I suppose, but I believe we use Update 3 on our Chromium buildbots, and they seem happy.

Can you paste the full error message? The part I see in your screenshot doesn't really make sense. Why should converting 1 to unsigned int be a narrowing conversion? I'm just trying to understand why we need this.

You can look at the file from screenshot and line numbers inside it - there's an implicit conversion from the enumeration TargetOpcode (which is signed int for my compiler without my change) to the unsigned int.

hans added a comment.Jun 20 2017, 8:17 AM

I still don't understand why this is breaking your build.

Assuming this is the line the first error refers to:

for (unsigned BinOp : {G_ADD, G_SUB, G_MUL, G_AND, G_OR, G_XOR, G_SHL}) {

I don't see how converting G_ADD, even if it is an int, to unsigned would be a narrowing conversion.

I did a fresh checkout of LLVM and built with VS 19.00.2415.1 for x64:

> svn export http://llvm.org/svn/llvm-project/llvm/trunk llvmtest
> mkdir llvmtest\build
> cd llvmtest\build
> cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is MSVC 19.0.24215.1
-- The CXX compiler identification is MSVC 19.0.24215.1
-- The ASM compiler identification is MSVC
...
> ninja
...

And everything built fine.

There must be something different with your configuration.

I've tried once again to make a clean build and it worked... :)
And I can't imagine what kind of configuration issue could it be because I always use quite the same one :)

yvvan abandoned this revision.Jun 27 2017, 4:09 AM

Can't reproduce an error anymore