[clang] [llvm] [clang][codegen] Prevent inline weak static locals from being placed in .rodata if not formally constant-initialized (PR #226645)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 26 12:03:39 PDT 2026
https://github.com/efriedma-quic commented:
Missing testcase. And somehow you mixed in your FROUND patch.
There's a FIXME related to this in CodeGenFunction::EmitVarDecl.
Skipping the guarded init is not threadsafe: if one thread accesses the variable while another thread is performing init, that's a race, even if the stored values are actually equal.
On targets that support comdats, we might be able to emit a guard variable in initialized form; that way, we wouldn't write to the variable even if it isn't constant-folded in some translation unit.
https://github.com/llvm/llvm-project/pull/226645
More information about the llvm-commits
mailing list