Skip to content

Make assembler expression arithmetic report overflow consistently #32

Closed

Description

@LunaStev

Current evidence

Audit baseline: master 3ac33ec1, after #11. Source: assembler/src/isa/amd64/parser.rs:372.

Reproduced in the debug build: adding one to i64::MAX in equ panics with exit 101. Parser sums, signed displacement accumulation and constant substitution use unchecked host arithmetic.

Reproduction

On Linux x86_64 (Rust 1.96.0), save as repro.asm:

section .text
N equ 9223372036854775807 + 1
dq N

Run cargo run -- asm --amd64 repro.asm -o repro.o.

Observed exit status: 101.

thread 'main' (22) panicked at assembler/src/isa/amd64/parser.rs:372:84:
attempt to add with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Scope

Difficulty: medium.

Use checked arithmetic throughout expression parsing/resolution and report a source diagnostic. Define a consistent accepted range rather than relying on debug/release overflow behavior.

Completion criteria

  • Overflow and underflow return ordinary errors in debug and release builds.
  • Numeric addition, symbol addends and memory constant substitution are covered.
  • No malformed expression triggers a host arithmetic panic.

Backlog index: #12. This issue owns only the bounded work described above.

Activity

  1. added
    bug
    help wanted
    assembler
    needs testing
    priority high
    on Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    assemblerbughelp wantedneeds testingpriority high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions