File: Test192.ML

package info (click to toggle)
polyml 5.8.1-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 57,736 kB
  • sloc: cpp: 44,918; ansic: 26,921; asm: 13,495; sh: 4,670; makefile: 610; exp: 525; python: 253; awk: 91
file content (8 lines) | stat: -rw-r--r-- 370 bytes parent folder | download
1
2
3
4
5
6
7
8
(* Overflow at compile time in unreachable code. *)

Array.update (Array.fromList [], ~1, 0) handle Subscript => ();
let val array = Array2.array (1, 1, 0) in Array2.sub (array, ~1, 0) handle Subscript => 0 end;
fun f r = Vector.sub(r, ~1);

(* This could also raise an exception in the compiler. *)
fun f r = Vector.sub(r, FixedInt.toInt(valOf FixedInt.maxInt) div 8);