crucible-llvm
rejects memory load of a struct with padding
#1219
Labels
crucible-llvm
rejects memory load of a struct with padding
#1219
crux-llvm
will choke on this C code which, as far as I can tell, is perfectly valid:The
Load from invalid memory at type i24
part of the error message hints at what is going on. Whenstruct s
is compiled to LLVM, it puts 24 bits of padding between fieldx
and fieldy
so that astruct s
value occupies exactly 64 bits. We can see this if we look at the LLVM bitcode:Note that
get_ss
returns ani64
instead of a%struct.s
, which reflects SystemV ABI requirements. This is all well and good, except for these lines:Here, we cast a
%struct.s
pointer to ani64
pointer and load ani64
value from the pointer.crucible-llvm
's memory model does not like the fact that 24 bits of thisi64
are padding and throws the error above.In order to fix this, we will likely need to relax this check in
crucible-llvm
's memory model. The following note in the LLVM language reference about thestore
instruction may be relevant:I wonder if we should do something similar.
The text was updated successfully, but these errors were encountered: