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

Galina Kistanova via cfe-commits cfe-commits at lists.llvm.org
Wed May 22 14:49:40 PDT 2019


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 at 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&view=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&r1=361427&r2=361428&view=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&view=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<typename T>
> +union_type var;
> +#pragma clang module end
> +#pragma clang module endbuild
> +#pragma clang module import foo
> +int main() {
> +  (void)&var<int>;
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190522/063b90aa/attachment.html>


More information about the cfe-commits mailing list