Skip to content
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

Comparison of escaped pointers too non-deterministic #1113

Open
nunoplopes opened this issue Nov 20, 2024 · 1 comment
Open

Comparison of escaped pointers too non-deterministic #1113

nunoplopes opened this issue Nov 20, 2024 · 1 comment
Labels
memory Memory Model

Comments

@nunoplopes
Copy link
Member

nunoplopes commented Nov 20, 2024

Here's a variant without zero-size types:

define i1 @src() {
    %a = alloca i64
    %a2 = alloca i32
    %gep = getelementptr i8, ptr %a, i64 8
    %cmp = icmp eq ptr %gep, %a2
    call void @escape(ptr %a, ptr %a2)
    ret i1 %cmp
}

define i1 @tgt() {
    %a = alloca i64
    %a2 = alloca i32
    %gep = getelementptr i8, ptr %a, i64 8
    %cmp = icmp eq ptr %gep, %a2
    call void @escape(ptr %a, ptr %a2)
    ret i1 false
}

declare void @escape(ptr, ptr)

This claims that two (non-zero-size) allocas can't have adjacent addresses.

Originally posted by @nikic in #1109 (comment)

@nunoplopes nunoplopes added the memory Memory Model label Nov 20, 2024
@nunoplopes
Copy link
Member Author

The issue is we related with the function call: if the pointers escape, their address may have been observed.

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

No branches or pull requests

1 participant