On this page

0230. Address sequence header words without negative subscripts

Context

GCC 14 constant propagation diagnoses the guarded negative size_t subscript in string concatenation when the left payload specializes to a literal. The cap-zero guard correctly excludes that read at runtime, but the warning breaks the M14.12 app's stderr-clean build contract.

Decision

Centralize the existing preceding used-length word address in hrt_seq_used, subtracting sizeof(size_t) from the payload's uintptr_t address. Use it for existing buffer header-word reads and writes in the runtime, CLI whole-file reads, emitted carry/map/par code and tests. Allocation initialization through the original used pointer is unaffected. The helper accepts const void * because hrt_str.data is const char *; its returned word is writable only for an owned buffer. Only buffer payloads may reach this helper; keep cap-zero and tip checks intact. The allocation layout, append behavior and both backend semantics stay fixed.

Also define _DEFAULT_SOURCE and _DARWIN_C_SOURCE in the interpreter FFI host before any include under strict C11 (ADR-0152). The host always defines them, a superset of the C backend, which emits them only when p.arenas != 0 || p.features != 0. This is intentional and safe: trusted app headers can need POSIX or Darwin declarations regardless of IR runtime features, and the macros only expose more declarations in the separate host translation unit. No language or diagnostic contract changes.

Alternatives considered

Consequences

Production flags remain unchanged. A small unsanitized C regression retains the failing constant-propagation shape; existing sanitizer tests continue to check header alignment, snapshot preservation and cap-zero views. Address conversion relies on the runtime's existing uintptr_t-capable POSIX targets.