Open pogo59 opened 5 months ago
@llvm/issue-subscribers-clang-codegen
Author: Paul T Robinson (pogo59)
See also https://github.com/llvm/llvm-project/issues/82994#issuecomment-1979503984 . (Not the same issue, but it's in the same part of the implementation.)
GCC specifies the "used" attribute as:
Inside a constant "if" condition, clang will fail to emit a "used" variable in the not-taken branch. This differs from GCC behavior.
Clang allocates only one variable, GCC allocates both. Given it's a GCC-defined attribute, we should behave the way GCC does. This appears to be a Clang codegen bug, as
-emit-llvm -disable-llvm-passes
shows only one item.(Why would I need this? It's part of the instrumentation for my Rotten Green Tests project. My static variables are actually allocated into a custom section, but that's not needed to trigger the bug.)