-
Notifications
You must be signed in to change notification settings - Fork 13.6k
non-exported variable in module interface unit has multiple addresses #130396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-clang-modules Author: None (Diltsman)
I posted this on Stack Overflow and it was suggested that I post this to Clang somewhere. I don't know if this is the correct place to do that.
I have a variable Is there some interaction between the C++ module and the anonymous namespace that is causing this? Is there some other cause of this problem? In n4928 (C++23-ish), 9.8.2.2 [namespace.unnamed] > ...all occurrences of unique in a translation unit are replaced by the To me, this indicates that both anonymous namespaces behave as if they have the same name, so having the declaration and definition of https://godbolt.org/z/59EWe5G3b For clang 19:
|
This is due to #112294 In short, the decls in anonymous namespaces are local to the TU, they shouldn't be accessed by other TUs. Clang should forbid it explicitly but we didn't do it. At least this is a false-negative. |
I posted this on Stack Overflow and it was suggested that I post this to Clang somewhere. I don't know if this is the correct place to do that.
I have a variable
exception_transformers
in coroutine.cpp. If this variable is in an anonymous namespace, then the output shows thatregister_exception_handler()
accesses it at an address 0x18 bytes beyond where every other function accesses it. Ifexception_transformers
is removed from the anonymous namespace, then it is accessed at the same address by all functions.Is there some interaction between the C++ module and the anonymous namespace that is causing this? Is there some other cause of this problem?
In n4928 (C++23-ish), 9.8.2.2 [namespace.unnamed]
To me, this indicates that both anonymous namespaces behave as if they have the same name, so having the declaration and definition of
transform_exception()
in two different anonymous namespaces in the same file shouldn't be causing an issue.https://godbolt.org/z/59EWe5G3b
For clang 19:
The text was updated successfully, but these errors were encountered: