Compiler E0360: extern pointer-width ABI guard¶
Summary¶
lic rejects MIR where extern proc -> ptr (or CallExtern to such symbols) would store or return a truncated i32, via verify_mir_extern_abi before LLVM emit (E0360).
Agent continuation¶
- Read
compiler/mir/mir_abi.cpp,compiler/codegen/compile.cpp(post-lower_to_mircall),li-tests/runtime/argv_ptr_abi.li. - Run
cmake --build build --target licandli-tests/run_all.shsuiteruntimefrom repo root withLI_REPO_ROOT=$PWD. - Then merge stacked PR on
cursor/extern-ptr-abi-guard-54aaaftercursor/httpd-proxy-bench-fix-54aa; rebuildli-httpdand refresh benchmarks matrix. - Blocked on human merge of proxy PR #153; no automated
merge-approvedon this branch.
Changed¶
| Area | Paths / evidence |
|---|---|
| MIR verify | compiler/mir/mir_abi.cpp, compiler/mir/include/li/mir_abi.hpp — extern returns_i64, CallExtern/CallProc is_i64/ret_is_i64 |
| Compile gate | compiler/codegen/compile.cpp — fail build with E0360 message before emit_llvm_ir |
| Codegen | compiler/codegen/emit.cpp — Li proc returns_i64 → LLVM i8* ret; ReturnIdent widens ptr returns |
| Lower | compiler/mir/lower.cpp — CallExtern sets ret_is_i64; return paths tag ret_is_i64 |
| Diagnostics | compiler/diagnostics/include/li/error_codes.hpp — E0360 |
| Tests | li-tests/runtime/argv_ptr_abi.li, li-tests/manifest.toml |
Not changed¶
trusted.lean/ Lean VC discharge scripts.std/runtime/seam.lisymbol list (proxy PR).- Tier-5 harness oracle configs in
benchmarks. - Typechecker rules for
ptrvsint(stillE0202at type level only).
Breaking¶
N/A — stricter compile-time check; correct programs unchanged.
Security¶
N/A — prevents silent UB from ABI truncation, not a new CVE class test.
Performance¶
N/A — verify pass is O(MIR insns) at compile time only.
Downstream¶
- benchmarks — no catalog change; consume lic builds that include this guard.
- li-httpd — rebuild after both proxy + guard PRs land on
main.