Re: r361428 - Modules: Code generation of enum constants for merged enum definitions

2019-05-22 Thread David Blaikie via cfe-commits
Ah, sure - thanks for the heads up! Fixed in r361439

On Wed, May 22, 2019 at 2:49 PM Galina Kistanova 
wrote:

> Hello David,
>
> This commit broke the test on the builder:
>
> http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/17793
> Please have a look?
> . . .
> Failing Tests (1):
> Clang :: Modules/enum-codegen.cpp
>
> The builder was already red and did not send any notifications.
>
> Thanks
>
> Galina
>
> On Wed, May 22, 2019 at 1:33 PM David Blaikie via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: dblaikie
>> Date: Wed May 22 13:36:06 2019
>> New Revision: 361428
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=361428=rev
>> Log:
>> Modules: Code generation of enum constants for merged enum definitions
>>
>> Found in a bootstrap of LLVM with implicit modules, resulting in a
>> deadlock of some Orc unit tests with libstdc++ 8.1. An enum was used as
>> part of the implementation of std::recursive_mutex and this bug resulted
>> in the constant initialization of zero instead of the desired non-zero
>> value. => Badness.
>>
>> Richard Smith tells me neither of these fields are necessarily canonical
>> & so using declaresSamEntity is the right solution here (rather than
>> changing both of these Fields to be canonical by construction/from their
>> source)
>>
>> Added:
>> cfe/trunk/test/Modules/enum-codegen.cpp
>> Modified:
>> cfe/trunk/lib/CodeGen/CGExprConstant.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=361428=361427=361428=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Wed May 22 13:36:06 2019
>> @@ -476,7 +476,7 @@ bool ConstStructBuilder::Build(const APV
>>for (RecordDecl::field_iterator Field = RD->field_begin(),
>> FieldEnd = RD->field_end(); Field != FieldEnd; ++Field,
>> ++FieldNo) {
>>  // If this is a union, skip all the fields that aren't being
>> initialized.
>> -if (RD->isUnion() && Val.getUnionField() != *Field)
>> +if (RD->isUnion() && !declaresSameEntity(Val.getUnionField(),
>> *Field))
>>continue;
>>
>>  // Don't emit anonymous bitfields, they just affect layout.
>>
>> Added: cfe/trunk/test/Modules/enum-codegen.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/enum-codegen.cpp?rev=361428=auto
>>
>> ==
>> --- cfe/trunk/test/Modules/enum-codegen.cpp (added)
>> +++ cfe/trunk/test/Modules/enum-codegen.cpp Wed May 22 13:36:06 2019
>> @@ -0,0 +1,36 @@
>> +// RUN: rm -rf %t
>> +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t %s -emit-llvm -o -
>> | FileCheck %s
>> +
>> +// CHECK: @_Z3varIiE = {{.*}} %union.union_type { i8 1 },
>> +
>> +#pragma clang module build bar
>> +module bar {
>> +  header "bar.h" { size 40 mtime 0 }
>> +  export *
>> +}
>> +#pragma clang module contents
>> +#pragma clang module begin bar
>> +union union_type {
>> +  char h{1};
>> +};
>> +#pragma clang module end
>> +#pragma clang module endbuild
>> +#pragma clang module build foo
>> +module foo {
>> +  header "foo.h" { size 97 mtime 0 }
>> +  export *
>> +}
>> +#pragma clang module contents
>> +#pragma clang module begin foo
>> +union union_type {
>> +  char h{1};
>> +};
>> +#pragma clang module import bar
>> +template
>> +union_type var;
>> +#pragma clang module end
>> +#pragma clang module endbuild
>> +#pragma clang module import foo
>> +int main() {
>> +  (void);
>> +}
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r361428 - Modules: Code generation of enum constants for merged enum definitions

2019-05-22 Thread Galina Kistanova via cfe-commits
Hello David,

This commit broke the test on the builder:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/17793
Please have a look?
. . .
Failing Tests (1):
Clang :: Modules/enum-codegen.cpp

The builder was already red and did not send any notifications.

Thanks

Galina

On Wed, May 22, 2019 at 1:33 PM David Blaikie via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: dblaikie
> Date: Wed May 22 13:36:06 2019
> New Revision: 361428
>
> URL: http://llvm.org/viewvc/llvm-project?rev=361428=rev
> Log:
> Modules: Code generation of enum constants for merged enum definitions
>
> Found in a bootstrap of LLVM with implicit modules, resulting in a
> deadlock of some Orc unit tests with libstdc++ 8.1. An enum was used as
> part of the implementation of std::recursive_mutex and this bug resulted
> in the constant initialization of zero instead of the desired non-zero
> value. => Badness.
>
> Richard Smith tells me neither of these fields are necessarily canonical
> & so using declaresSamEntity is the right solution here (rather than
> changing both of these Fields to be canonical by construction/from their
> source)
>
> Added:
> cfe/trunk/test/Modules/enum-codegen.cpp
> Modified:
> cfe/trunk/lib/CodeGen/CGExprConstant.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=361428=361427=361428=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Wed May 22 13:36:06 2019
> @@ -476,7 +476,7 @@ bool ConstStructBuilder::Build(const APV
>for (RecordDecl::field_iterator Field = RD->field_begin(),
> FieldEnd = RD->field_end(); Field != FieldEnd; ++Field, ++FieldNo)
> {
>  // If this is a union, skip all the fields that aren't being
> initialized.
> -if (RD->isUnion() && Val.getUnionField() != *Field)
> +if (RD->isUnion() && !declaresSameEntity(Val.getUnionField(), *Field))
>continue;
>
>  // Don't emit anonymous bitfields, they just affect layout.
>
> Added: cfe/trunk/test/Modules/enum-codegen.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/enum-codegen.cpp?rev=361428=auto
>
> ==
> --- cfe/trunk/test/Modules/enum-codegen.cpp (added)
> +++ cfe/trunk/test/Modules/enum-codegen.cpp Wed May 22 13:36:06 2019
> @@ -0,0 +1,36 @@
> +// RUN: rm -rf %t
> +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t %s -emit-llvm -o - |
> FileCheck %s
> +
> +// CHECK: @_Z3varIiE = {{.*}} %union.union_type { i8 1 },
> +
> +#pragma clang module build bar
> +module bar {
> +  header "bar.h" { size 40 mtime 0 }
> +  export *
> +}
> +#pragma clang module contents
> +#pragma clang module begin bar
> +union union_type {
> +  char h{1};
> +};
> +#pragma clang module end
> +#pragma clang module endbuild
> +#pragma clang module build foo
> +module foo {
> +  header "foo.h" { size 97 mtime 0 }
> +  export *
> +}
> +#pragma clang module contents
> +#pragma clang module begin foo
> +union union_type {
> +  char h{1};
> +};
> +#pragma clang module import bar
> +template
> +union_type var;
> +#pragma clang module end
> +#pragma clang module endbuild
> +#pragma clang module import foo
> +int main() {
> +  (void);
> +}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits