;;;; A store through (bytes-view "literal") lands in the string constant's ;;;; own storage, which both backends emit read-only — LLVM as a `constant` ;;;; global, x86 in .rodata — so the write traps where it happens instead of ;;;; corrupting the literal. Pinned at -O0 on both backends, where the store ;;;; is really emitted; at -O2 LLVM deletes it as undefined behaviour, which ;;;; is why this program has no -O2 row. The trap itself (SIGSEGV on a ;;;; read-only page) is the defined consequence of the emission, not a bet on ;;;; anything further. ;;;; ;;;; If this ever exits 0, string data has become writable somewhere and the ;;;; read-only-by-convention story of bytes-view is silently gone. (defn main [] i32 (let [v (bytes-view "INSERTIONSORT")] (set (at v 0) \Z) ;; Never reached: the store above traps. Printing anyway makes a failure ;; loud — output where none was expected. (print (string v)) 0))