File: Test154.ML

package info (click to toggle)
polyml 5.7.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 40,584 kB
  • sloc: cpp: 44,143; ansic: 26,963; sh: 22,002; asm: 13,486; makefile: 602; 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 ();