Issue 239927
Summary [clang][CodeGen][MS ABI] Internal-linkage `thread_local` variable template with dynamic initializer asserts in `MicrosoftCXXABI::EmitGuardedInit`
Labels clang:codegen, platform:windows, crash, generated by fuzzer
Assignees
Reporter YuanchengJiang
    The following code:
```cpp
int f();
namespace { template <int = 0> thread_local int n = f(); }
int g() { return n<>; }
```

Resulted in this output:
```
clang++: /root/llvm-project/llvm/tools/clang/lib/CodeGen/MicrosoftCXXABI.cpp:2671: virtual void {anonymous}::MicrosoftCXXABI::EmitGuardedInit(clang::CodeGen::CodeGenFunction&, const clang::VarDecl&, llvm::GlobalVariable*, bool): Assertion `GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()' failed.
```

Trunk reproducer (`--target=i686-pc-windows-msvc`): https://godbolt.org/z/GMfadodE4
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to