Closed
Labels
bugA problem that causes incorrect behavior or crashes.help wantedThe issue requires extra attention or help from others.needs testingIssues that require additional testing or verification.technical debtIssues that represent potential future improvements or problems.
Description
Summary
LLVM address generation accepts integer literals and a small set of lvalue expressions as array or pointer indices, then panics for other expression forms. Semantically valid indices such as arithmetic expressions, casts, and function results must not reach an unsupported backend panic.
Related issue
Relevant code
llvm/src/codegen/address.rs- expression lowering and typed expression information
- semantic index validation
Scope
Use the normal typed integer expression lowering path for index operands, then normalize the resulting integer to the target index width. Keep address calculation and GEP invariants explicit.
Acceptance criteria
- Literals, variables, arithmetic, grouped expressions, casts, field results, and function-call results work as indices when semantically valid.
- Signed and unsigned integer widths are normalized deliberately.
- Non-integer indices are rejected by the frontend with a source diagnostic.
- No index expression can trigger
Index int expr not supported yetor an equivalent panic. - Tests cover arrays, pointers, nested indexing, negative indices where permitted, and target-width differences.
- Existing opaque-pointer and GEP safety invariants remain documented and valid.
Metadata
Metadata
Assignees
Labels
bugA problem that causes incorrect behavior or crashes.help wantedThe issue requires extra attention or help from others.needs testingIssues that require additional testing or verification.technical debtIssues that represent potential future improvements or problems.
Activity
LunaStev commentedon Sep 8, 2026
Additional CI evidence from draft PR #520 at
2ae0a91c57fd76323124c0e4dff552adbfadbe1b:The LoongArch regression job fails
loongarch64_shared_language_workloads_run_under_qemubefore linking/execution. The new workload usestag.bytes[i % 9]at shared/loong64/test5.wave:205, and semantic validation reports E3001:index expression must currently be an integer literal or integer lvalue.The LoongArch cases compile job reports the same expression. This supplies a concrete arithmetic-index acceptance case for this issue; it does not establish a LoongArch ABI or QEMU execution failure. Preserve the workload and support the valid typed index expression instead of hiding it behind a target skip.
These are existing remote CI logs; no additional local reproduction was run during this audit.
fix(codegen): support typed integer indices and restore strict Clippy (…