raz / conform / run / StopDivLowest.raz

22 lines · 432 B · raw · history · last change 7e721e08

1(* Dividing the smallest I64 by -1 stops the program. The program ends with status 2, after the procedures registered
2 with Rt.atExit, so that what it wrote is out. *)
3module StopDivLowest;
4import Out, Rt;
5
6
7proc bye;
8begin
9 Out.str("bye\n");
10end;
11
12proc main*;
13var a, b: I64;
14begin
15 _ := Rt.atExit(bye);
16 a := -9223372036854775807 - 1;
17 b := -1;
18 Out.str("before\n");
19 Out.int(a div b);
20end;
21
22end StopDivLowest.