rust-lang / rustc_codegen_gcc

libgccjit AOT codegen for rustc
Apache License 2.0
893 stars 61 forks source link

Make sure `offset(0)` is handled correctly #515

Open RalfJung opened 1 month ago

RalfJung commented 1 month ago

The offset intrinsic (called inbounds_gep in the codegen_ssa API) is now always defined when the offset is 0, even if the pointer is 0 or dangling.

The GCC backend uses new_array_access to model that; it is important to make sure that if the index is 0, this is never UB.