raz / commit 41d060be

commit
41d060be75382b54ef4c8c246cb03a29525573ef
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
65ec213a
Report 10.22.2: every stop of a running program exits with status 2 (the compiler follows in a later step)

patch · log

2 files changed, +10 -6

doc/compiler.md (history) modified +2 -1

@@ -1484,7 +1484,8 @@
14841484 and ends it the same way. A signal
14851485 is told at the place of the statement it stopped in, or of the
14861486 procedure for a stack overflow in its prologue, and then ends the
1487- program, so its status is the signal's. The handlers run on a stack
1487+ program as the report says, with status 2 (until `Rt`'s handlers
1488+ do so, its status is the signal's). The handlers run on a stack
14881489 of their own: `Rt`'s for the main thread, one in each `Thread`
14891490 thread's mapping. C's threads have none, so a stack overflow in one
14901491 ends the program by the signal with no message.

doc/raz.md (history) modified +8 -5

@@ -638,7 +638,7 @@
638638 `div` rounds toward zero and `mod` takes the sign of the dividend, as
639639 in C: `-7 div 2` is `-3`, `-7 mod 2` is `-1`. Dividing by zero, and
640640 dividing the smallest value of a signed type by `-1`, stop the program
641-(`SIGFPE`), whatever the type and the target.
641+(section 10), whatever the type and the target.
642642
643643 `&` (and), `|` (or), `xor` and `~` (not) work on every bit. `x shl n`
644644 and `x shr n` shift by `n` modulo the width of `x`'s type, in bits:
@@ -1268,9 +1268,11 @@
12681268 procedures registered with `Rt.atExit`, the last registered first,
12691269 each at most once; then it ends the program with `status`, through
12701270 C's `exit` in a program that uses C, so that C flushes its own
1271-buffers. A failed check (section 6.5) runs them too, after its
1272-message, so that `Out`'s buffer is written out. `Sys.exit` ends the
1273-program at once, and a program stopped by a signal runs none of them.
1271+buffers. A program that stops (below), a failed check
1272+(section 6.5) included, runs them too, after its message, so that
1273+`Out`'s buffer is written out, and ends with status 2. `Sys.exit` ends
1274+the program at once, and a program killed by a signal from outside runs
1275+none of them.
12741276
12751277 ```
12761278 proc atExit*(p: proc): ERROR; (* Rt.Full if 32 are registered *)
@@ -1296,7 +1298,8 @@
12961298 breaks its rules, and C code can read or write any memory, and what
12971299 follows isn't defined. Dereferencing `nil`, dividing
12981300 by zero, calling a `nil` procedure and running out of stack stop the
1299-program, on every target. Before it stops, the program prints to
1301+program, on every target, with status 2, as a failed check does.
1302+Before it stops, the program prints to
13001303 standard error where it was, as file, line and column, and why, as far
13011304 as it can tell: a `nil` pointer, a `nil` procedure, a stack overflow, a
13021305 bad address or a division fault; then the calls under way, each with