File: Test131.ML

package info (click to toggle)
polyml 5.6-8
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 31,892 kB
  • ctags: 34,453
  • sloc: cpp: 44,983; ansic: 24,520; asm: 14,850; sh: 11,730; makefile: 551; exp: 484; python: 253; awk: 91; sed: 9
file content (46 lines) | stat: -rw-r--r-- 1,638 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(* Bug test for pushing a value that won't fit in a 32-bit literal. *)

(* Original test from Rene Neumann *)

datatype bexp = Tt | Ff | V of IntInf.int | Not of bexp | And of bexp * bexp |
  Or of bexp * bexp;

fun bexp_rec f1 f2 f3 f4 f5 f6 Tt = f1
  | bexp_rec f1 f2 f3 f4 f5 f6 Ff = f2
  | bexp_rec f1 f2 f3 f4 f5 f6 (V nat) = f3 nat
  | bexp_rec f1 f2 f3 f4 f5 f6 (Not bexp) =
    f4 bexp (bexp_rec f1 f2 f3 f4 f5 f6 bexp)
  | bexp_rec f1 f2 f3 f4 f5 f6 (And (bexp1, bexp2)) =
    f5 bexp1 bexp2 (bexp_rec f1 f2 f3 f4 f5 f6 bexp1)
      (bexp_rec f1 f2 f3 f4 f5 f6 bexp2)
  | bexp_rec f1 f2 f3 f4 f5 f6 (Or (bexp1, bexp2)) =
    f6 bexp1 bexp2 (bexp_rec f1 f2 f3 f4 f5 f6 bexp1)
      (bexp_rec f1 f2 f3 f4 f5 f6 bexp2);

fun hashcode_bexp x =
  bexp_rec (2037113697 : IntInf.int) (1965105786 : IntInf.int)
    (fn x_0 =>
      IntInf.+ (IntInf.* ((1562730118 : IntInf.int), x_0),
        (1569390485 : IntInf.int)))
    (fn _ => fn res_0 =>
      IntInf.+ (IntInf.* ((1384320508 : IntInf.int), res_0),
        (1390980875 : IntInf.int)))
    (fn _ => fn _ => fn res_0 => fn res_1 =>
      IntInf.+ (IntInf.* ((238441399 : IntInf.int), res_0),
        IntInf.+ (IntInf.* ((231781032 : IntInf.int), res_1),
          (245101766 : IntInf.int))))
    (fn _ => fn _ => fn res_0 => fn res_1 =>
      IntInf.+ (IntInf.* ((2025552342 : IntInf.int), res_0),
        IntInf.+ (IntInf.* ((2018891975 : IntInf.int), res_1),
          (2032212709 : IntInf.int))))
    x;

(* Alternative test. *)

PolyML.Compiler.maxInlineSize := 1;

fun f (a,b,c,d,e,f) = f;

if f(0,0,0,0,0,2037113697) = 2037113697
then ()
else raise Fail "Compilation error";