Clang will create a global value put in constant memory if an aggregate value
is declared firstprivate in the target device. The symbol name only uses the
name of the firstprivate variable, so symbol name conflicts will occur if the
variable is allowed to have different types through templates. An example of
this behvaiour is shown in https://godbolt.org/z/EsMjYh47n. This patch adds the
mangled type name to the symbol to avoid such naming conflicts. This fixes
https://bugs.llvm.org/show_bug.cgi?id=50642.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
10598 | What if the code is not C++? |
clang/lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
10598 | Should work fine, this just mangles it according to the C++ ABI but doesn't require it being C++ as far as I know. Testing it with a sample C file creates the same symbol name as the C++ version. |
Comment Actions
Changing to only mangle when using C++. It should be correct either way but is unnecessary with C.
What if the code is not C++?