Skip to content

extern_weak globals may be nullptr #1185

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

Open
workingjubilee opened this issue Mar 31, 2025 · 1 comment
Open

extern_weak globals may be nullptr #1185

workingjubilee opened this issue Mar 31, 2025 · 1 comment

Comments

@workingjubilee
Copy link

Alive2 asserts this transformation is correct: https://alive2.llvm.org/ce/z/YX8gMP

@GLIBC_PRIVATE = extern_weak global {}

define noundef zeroext i1 @src() unnamed_addr {
start:
  %_ptr = ptrtoint ptr @GLIBC_PRIVATE to i64
  %_0 = icmp eq i64 %_ptr, 0
  ret i1 %_0
}

define noundef zeroext i1 @tgt() unnamed_addr {
start:
  ret i1 false
}

However, I'm told by llvm/llvm-project#133621 that this is in fact incorrect specifically for the case of extern_weak linkage. This is a fairly subtle bug, but may be because Alive2 is discarding the linkage instead of examining it.

@workingjubilee workingjubilee changed the title Alive2 does not distinguish extern_weak globals extern_weak globals may be nullptr Mar 31, 2025
@nunoplopes
Copy link
Member

Linkage is currently ignored by Alive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants