https://bugs.llvm.org/show_bug.cgi?id=37595
Bug ID: 37595
Summary: -fvisibility-inlines-hidden marks static local
variables as hidden when it shouldn't
Product: clang
Version: 3.2
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: redbeard0...@gmail.com
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
At the very least this is a scary undocumented difference from that flag's
meaning under gcc. Quoting the gcc man page for that flag (emphasis mine): The
behavior of this switch is not quite the same as marking the methods as hidden
directly, because ***it does not affect static variables local to the
function*** or cause the compiler to deduce that the function is defined in
only one shared object.
https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fvisibility-inlines-hidden
only says "Give inline C++ member functions default visibility by default"
which doesn't seem to accurately describe the behavior.
Here is a simple example that shows the issue: https://godbolt.org/g/63FiwD
inline int* test() {
static int staticVar;
return &staticVar;
}
auto force = test();
The problematic line is in the generated ASM is ".hidden test()::staticVar".
That is only generated with clang with -fvisibility-inlines-hidden. gcc does
not add that line to the output. I walked back the versions on godbolt and it
looks like this was introduced between 3.1 and 3.2.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs