flan/test/programs/dev-segv.flan

22 lines
967 B
Plaintext

;;;; A hardware fault, taken on purpose: a store through a null pointer takes
;;;; SIGSEGV. In a dev session that used to kill the whole process — daemon,
;;;; compiler and socket together, with no message at all. The dev build's
;;;; crash handler turns it into the same park the no-channel traps take: one
;;;; line naming the address and the frame, then the break loop, with the
;;;; daemon alive and answering behind it. There is no restart to list — a
;;;; faulting instruction has nowhere to resume at — which is the same
;;;; empty-list shape dev-trap-null-alloc.flan pins for free-all.
;;;;
;;;; The crash that first raised this was a write through a bytes-view of a
;;;; string literal, which no longer compiles; a zeroed pointer is the
;;;; surviving way to fault.
(import agent "vendor:agent")
(defonce nowhere (Ptr u8))
(defn main [] i32
(agent/start "/tmp/flan-dev-segv-fallback.sock")
(set (deref nowhere) \Z)
(println "not reached")
0)