raz / test / run / StopStatus.raz

20 lines · 365 B · raw · history · last change 7924cbb7

1(* A failed check ends the program with 2, which the procedures atExit
2 registered can see. *)
3module StopStatus;
4import Out, Rt;
5
6proc report;
7begin
8 Out.str("ending with "); Out.int(Rt.exitStatus()); Out.str("\n");
9end;
10
11proc main*: INT;
12var a: [2]INT; i: INT;
13begin
14 _ := Rt.atExit(report);
15 i := 5;
16 a[i] := 1;
17 return 0;
18end;
19
20end StopStatus.