Repository navigation
feat(codegen): i32 arithmetic in a fallible body fails with ML_ST_OVERFLOW (-3) instead of wrapping - #334
Merged
Conversation
…RFLOW instead of wrapping SPEC-checked-arithmetic §6 task 1 (DP-O1..O9, user-confirmed 2026-09-26). In a fallible body (`-> T!`, `-> string!`, `-> [T]!`) i32 `+ - *`, unary `-`, `i32::MIN / -1`, and `f64 as i32` of NaN or a value that truncates outside i32 return the new reserved status ML_ST_OVERFLOW = -3. `%` keeps wrapping_rem (DP-O5: MIN % -1 = 0 exists). Infallible bodies keep wrapping and saturating; an infallible helper is the escape hatch (DP-O7). Literal-only overflow fails at run time (DP-O9). Fingerprints and the ABI version are unchanged (DP-O4) — no IFACE_HASH line moved in the goldens. The .h and .pas declare ML_ST_OVERFLOW from one predicate, ir::can_fail_overflow, only for modules with a fallible body that can reach it; the binding matrix in bindings.rs gains the row and column. Docs that this makes false are fixed in the same change: LANGUAGE.md (wrap, division, conversion, gap block), HOST_ABI.md (status table, current boundary, retry note), STATUS §5-4 and the start block, both READMEs, the SPEC status and the slice index. Oracle value tests moved into this PR for that reason. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…price LANGUAGE.md names, measured Grok verify (docs vs tests) noted the sentence had no input and no assert. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner
Author
🔵 SCAManager 분석 결과총점: 89/100 (등급 B) 점수 상세
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SPEC-checked-arithmetic§6 작업 1. DP-O1~O9 사용자 확인(2026-09-26). 관련: D17(음수 status 예약), D18(ABI 버전 — 불변).무엇이 바뀌나
실패 가능 본문(
-> T!·-> string!·-> [T]!) 안에서:!본문+ - *, 단항-ML_ST_OVERFLOW=-3i32::MIN / -1-3x / 0,x % 0,i32::MIN % -10(DP-N4, DP-O5)0f64 as i32-3-3(DP-O9)..h/.pas는 한 술어(ir::can_fail_overflow, 실패 가능 함수만)로 낼 수 있는 모듈에만ML_ST_OVERFLOW를 선언한다.IFACE_HASH줄은 하나도 움직이지 않았다.LANGUAGE.md(wrap·나눗셈·변환·공백 블록),HOST_ABI.md(status 표·현재 경계·재시도),STATUS.md§5-4와 시작 블록, 두 README, SPEC 상태, 슬라이스 색인. 그래서 오라클 값 테스트도 작업 2에서 이쪽으로 옮겼다(SPEC §6에 적음).근거 (E2)
MATHLESS_GATE_D=require MATHLESS_GATE_FPC=require MATHLESS_GATE_FPC_HOST=require cargo test --workspace --locked— exit 0, 79개 바이너리 전부 ok, 건너뜀 없음. 골든 재생성 뒤 생성 헤더를cl /W4 /WX·FPC가 컴파일한다.hosts/rust-oracle/tests/checked_arithmetic.rs, 7개): 연산마다 경계 양쪽,MIN % -1 = 0,f64 as i32의 NaN·±inf·3e9,string!·[T]!모양,result뒤 재호출도-3, 무한 본문은 wrap, 리터럴, 헬퍼, 중간값 오버플로.+ - *끄기 → 골든 + 오라클 4 ·checked_neg끄기 → 오라클 ·%에checked_rem의미 → 골든 + 오라클 · 변환 상한 1 줄이기 → 오라클 · 술어에서+ - *빼기 → 바인딩 행렬 + 표 + 골든 2 · 술어가 무한 본문도 보기 → 표 + 골든 2.doc_claims50/50,language_gaps, fmt, clippy-D warnings.Grok 2차 검증 (한 번에 주장 하나, 6회 — 전부 CONFIRMED)
+ - *·단항-방출이 모양별 bail · 무한 본문 wrap/의MIN/-1bail, 피연산자 왼쪽부터,%는 템플릿 그대로(-2147483649, 2147483648)= 절단이 i32에 드는 집합, NaN·inf 포함.h·.pas선언이 한 술어·abi.rs상수LANGUAGE.md가 적은 값이 오라클 테스트에 단언돼 있다 — UNASKED 줄이 빈틈 하나를 찾았다: "중간값만 넘쳐도 실패" 문장에 측정이 없었다 →an_intermediate_overflow_fails_even_when_the_answer_fits추가(df6506b).남은 것 (작업 2, 별도 PR)
실제 C 호스트가
-3을 받는 수용 D · §9-69의 161행 재측정 · 크기 변화 · 슬라이스 닫기.🤖 Generated with Claude Code