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

Alloc opt creates invalid GC pointer #55305

Open
wsmoses opened this issue Jul 29, 2024 · 1 comment
Open

Alloc opt creates invalid GC pointer #55305

wsmoses opened this issue Jul 29, 2024 · 1 comment
Labels
compiler:optimizer Optimization passes (mostly in base/compiler/ssair/) GC Garbage collector

Comments

@wsmoses
Copy link
Contributor

wsmoses commented Jul 29, 2024

Input test case is https://godbolt.org/z/77f9K43bj

  %17 = call noalias nonnull dereferenceable(352) dereferenceable_or_null(352) {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %16, i64 noundef 352, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 131902303301776 to {}*) to {} addrspace(10)*)), !dbg !412
  %18 = bitcast {} addrspace(10)* %17 to { i8*, i8*, { {} addrspace(10)*, {} addrspace(10)*, i8*, i8*, i64 }, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, i64 } addrspace(10)*, !dbg !412

This object is optimized by Julia into part of the [X x {} addrspace(10)] on the stack. This is invalid because the i8's [and i64] are not necessarily valid julia objects. This results in garbage collection reading that memory and crashing.

cc @gbaraldi @vtjnash @vchuravy

@wsmoses
Copy link
Contributor Author

wsmoses commented Jul 29, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:optimizer Optimization passes (mostly in base/compiler/ssair/) GC Garbage collector
Projects
None yet
Development

No branches or pull requests

1 participant