File: Test154.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 (15 lines) | stat: -rw-r--r-- 437 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(* Bug in X86 code-generation.  Because the tag is subtracted AFTER the operation
   an operation that actually overflows may not be correctly detected. *)



fun t (x: LargeInt.int) = x + x * 1073741824;

(* Use ! and ref here to prevent the compiler interpreting it. *)
if ! (ref t) ~1 > 0 then raise Fail "wrong" else ();

fun s (x: LargeInt.int) = x + x * 4611686018427387904;

if ! (ref s) ~1 > 0 then raise Fail "wrong" else ();