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

unsafe pointers with non-isbits may crash #50125

Closed
vtjnash opened this issue Jun 10, 2023 · 1 comment · Fixed by #50164
Closed

unsafe pointers with non-isbits may crash #50125

vtjnash opened this issue Jun 10, 2023 · 1 comment · Fixed by #50164
Labels
compiler:codegen Generation of LLVM IR and native code kind:bug Indicates an unexpected problem or unintended behavior

Comments

@vtjnash
Copy link
Sponsor Member

vtjnash commented Jun 10, 2023

This is dead code (generated by inference), but we should make sure codegen doesn't crash on it. The problem is we are trying to store an FCA, which is not directly quite legal.

(gdb) p jl_dump_llvm_value(src.V)
  %value_phi1 = phi { i32, {} addrspace(10)* } 
$10 = void
(gdb) p jl_(src.typ)
OpenTelemetryAPI.SpanStatus
$11 = void

oolong-dev/OpenTelemetry.jl#80 (comment)

MWE:

julia> struct AA; a::Int; b::Union{Nothing,String}; end
julia> code_llvm((String,)) do x; unsafe_store!(Ptr{AA}(1), AA(0,x)); end
@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Jun 10, 2023

aside, in v1.8, this slightly simplified MWE would generate good code from the optimizer, and it does not anymore, so this MWE was a bit harder to reproduce:

julia> code_typed(()) do; unsafe_store!(Ptr{AA}(1), AA(0,"")); end

@vtjnash vtjnash added kind:bug Indicates an unexpected problem or unintended behavior compiler:codegen Generation of LLVM IR and native code labels Jun 10, 2023
KristofferC pushed a commit that referenced this issue Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant