forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
codegen: on alignment incongruence, replace assert by jl_error
It is possible that LLVM and Julia disagree on the offsets of struct fields. This has been observed in JuliaLang#32414 in cases like Tuple{Float64, NTuple{8, VecElement{Float64}}} where LLVM wants to align the `vec` on 64 bytes (adding 56 bytes of padding after the first `Float64`) but Julia refusing to align like that because it can't guarantee that on the heap: https://github.com/JuliaLang/julia/blob/c7e9d9f8ade647582c6635c8c9a587f2360af404/src/datatype.c#L453 There is no easy solution this I can see, but since this can be triggered from pure Julia, the least we can do is not abort the program. For this reason, this commit replaces the assert by jl_error. To be able to give a sort-of meaningful error message, we return a sentinel value from `convert_struct_offset` and generate an error message in the caller.
- Loading branch information
Showing
1 changed file
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters