codegen: on alignment incongruence, replace assert by jl_error #34245
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is possible that LLVM and Julia disagree on the offsets of struct
fields. This has been observed in #32414 in cases like
where LLVM wants to align the
vec
on 64 bytes (adding 56 bytesof padding after the first
Float64
) but Julia refusing toalign like that because it can't guarantee that on the heap:
julia/src/datatype.c
Line 453 in c7e9d9f
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 generatean error message in the caller.