-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Llvm memory corruption on duplicate static with one being weak and the other not #59062
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
Labels
A-linkage
Area: linking into static, shared libraries and binaries
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
I-crash
Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
Trace for assertion failure in alt build:
|
The linkage attribute introduces an additional level of indirection. As a result there is a type mismatch in the original example. Given the current unusual implementation of this attribute, a correct way to use it would be: #![feature(linkage)]
fn main() {
extern {
#[linkage = "weak"]
static A: *const u8;
}
{
#[no_mangle]
static A: u8 = 1;
}
unsafe { assert_eq!(*A, 1); }
} |
This doesn't crash anymore. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-linkage
Area: linking into static, shared libraries and binaries
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
I-crash
Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The text was updated successfully, but these errors were encountered: