Skip to content

v1.5.1 — Freestanding fixes: strings, division, and refcounting under --bare

Choose a tag to compare

@torvik-lang torvik-lang released this 02 Aug 10:54
· 38 commits to main since this release
Immutable release. Only release title and notes can be modified.
ae22642

A patch release fixing three bugs that made --bare builds fail to link. All three are freestanding-only — hosted programs are unaffected, and no behavior changes for existing code.

Fixed:

len() on a str under --bare referenced an undefined @strlen. The freestanding strlen/strcmp implementations existed but were emitted only alongside the on_alloc/on_free shims, so a bare program that used a string without defining an allocator failed at link time.

Integer division and modulo under --bare referenced an undefined torvik_div/torvik_mod. A freestanding program could not divide at all — which also meant it could not format a number for display. torvc now emits freestanding implementations carrying the same divide-by-zero and INT64_MIN / -1 checks the runtime performs; with no stderr to report through, a violation parks the CPU.

A str local under --bare referenced an undefined torvik_str_retain/torvik_str_release. String locals are reference-counted on scope entry and exit even when the string is a literal, so any bare program that named a string hit this. String literals carry an immortal refcount, so with no allocator present both operations are correctly no-ops.

Install:

Linux

curl -fsSL https://raw.githubusercontent.com/torvik-lang/torvik/main/linux/install.sh | sh

Windows (PowerShell)

iwr -useb https://raw.githubusercontent.com/torvik-lang/torvik/main/windows/install.ps1 | iex

Already have Torvik?

rune update