rust-lang / rust-lang/rustc_codegen_gcc
Make sure `offset(0)` is handled correctly
Open
Nobody has claimed this yet.
libgccjit
- Dominant language
- Rust
- Stars
- 1.2k
- Forks
- 105
- Avg merge
- 8h 20m
- Merged PRs (30d)
- 14
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the GCC backend's new_array_access handling of the offset intrinsic, called inbounds_gep in the codegen_ssa API. Check the zero-index path, including null or dangling pointers, and add or update coverage so offset(0) is never treated as undefined behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100