raz / test / run / HeapStray.raz

15 lines · 294 B · raw · history · last change 264716cb

1(* Freeing what the heap never gave out stops the program. *)
2module HeapStray;
3import Out, Heap, Mem;
4import SYSTEM;
5
6var a: [4]I64;
7
8proc main*;
9begin
10 Out.str("freeing a stray pointer\n");
11 Mem.free(Heap.heap, ^U8(SYSTEM.ADR(a[2])));
12 Out.str("not reached\n");
13end;
14
15end HeapStray.