Skip to content

Morrow v2.4.18 — Pointer Semantics, Sized Integers, and a Standalone Toolchain

Choose a tag to compare

@LeTrollologist LeTrollologist released this 09 Nov 15:48
· 13 commits to main since this release

Morrow v2.4.18 — Pointer Semantics, Sized Integers, and a Standalone Toolchain

Release date: 2026-11-09
Toolchain: forge 2.4.18 (morrow standalone 2026)
Self-hosting fixed point: D9FF387175979C534040AB5ED9AAAB9696C95FDEA096393678D2E994F877CDFE
(stage2.ll == stage3.ll, stage2.exe == stage3.exe, 536,064 bytes)

This release closes the three remaining Critical/High findings from
docs/AUDIT-2026-11-08.md that were blocking normal
systems programming: pointer/reference semantics, sized integers, and
location-independent toolchain paths.

Pointer, reference, and cast semantics (C-03 / issue #3)

  • parse_type retains *mut T, *const T, &T, and &mut T in the interned type.
  • Scalar &lvalue lowers to real storage; struct/String/pointer bindings keep the
    by-reference pointer value used by the compiler's calling convention.
  • *mut Struct field stores use correct offsets; *mut u8/i8 indexing uses byte
    stride, and u16/u32 indexing uses 2/4-byte strides.
  • Casts are type-directed: width truncation plus sign/zero extension; pointer casts
    are i64 identity.
  • Address-of a non-lvalue is diagnosed.
  • ffi_demo.exe now exits 0 (prints 40 and 100 instead of access-violating).

Sized integer semantics (issue #10)

  • i8/i16/i32/i64/u8/u16/u32/u64 now carry width and signedness through type checking.
  • Arithmetic and storage wrap modulo 2^width; assignments, fields, and index stores
    normalize to the destination width.
  • Signed loads/casts sign-extend; unsigned loads/casts zero-extend; i8 array reads
    of -1 now produce -1.
  • Signed vs unsigned division/remainder and comparisons are distinguished, including
    u64 high-bit comparisons.
  • Integer literals outside i64 are rejected instead of silently wrapping.

Examples: let v: u8 = 250 + 10 → 4; 300 as u8 → 44; i8 load of 0xFF → -1;
u64 0-1 > 1 → true.

Standalone, location-independent toolchain (issue #12)

  • std/, compiler/, and lib/crt resolve from the executable's installation root
    via GetModuleFileNameA, not the caller's working directory.
  • Windows link lines use absolute lib/crt paths.
  • forge new scaffolds a buildable fn main() -> i64 { 0 } project.
  • Unsupported --target triples are rejected before writing files or running clang.

Verified by building from an unrelated directory, scaffolding/building a project in
place, and checking --target bogus fails.

Bootstrap and correctness fixes found during self-hosting

  • Optimizer handler-balance check now uses the real TirFunction.args block list.
  • Generic pointer arguments normalize to the bare container identity (Vec<*mut T>
    behaves as Vec<T> for shallow generics), and generic type symbols retain their
    closing >.
  • as binds looser than unary &, so &mut counter as *mut T means
    (&mut counter) as *mut T.

Verification

Gate Result
Native suites 23 positive
Compile-fail suites 18
Examples 22/22 build
CWD/scaffold/target tests pass
Bootstrap stage2/stage3 IR and executable byte-identical
Distribution Morrow-v2.4.18-win64.zip, forge.exe, mwc.exe, SHA256SUMS.txt

New regression coverage in tests/syntax_features_test.mw: pointer storage, field
offsets, byte/word indexing, casts, integer arithmetic/storage/loads, u64
comparisons, CWD-independent builds, forge new, and unsupported-target rejection.

Compatibility

Source-compatible with v2.4.17. Programs that relied on unsized integer behavior
(260 in a u8, zero-extended i8 loads, pointer-as-value &scalar) now follow
their declared types. Struct fields still occupy 8-byte slots with normalized
values, and u64 is carried in the i64 register representation.