Просмотр исходного кода

Small bugfix in dimension reduction which caused array indices to be calculated incorrectly

Taddeus Kroes 12 лет назад
Родитель
Сommit
6816f01bf6
2 измененных файлов с 2 добавлено и 2 удалено
  1. 1 1
      phases/constant_propagation.ml
  2. 1 1
      phases/dim_reduce.ml

+ 1 - 1
phases/constant_propagation.ml

@@ -149,7 +149,7 @@ let rec propagate consts node =
     | _ -> transform_children propagate node
 
 let rec prune_vardecs consts = function
-    | VarDec (ctype, name, init, loc) when Hashtbl.mem consts name -> Block []
+    | VarDec (ctype, name, init, loc) when Hashtbl.mem consts name -> DummyNode
     | node -> transform_children (prune_vardecs consts) node
 
 let rec phase input =

+ 1 - 1
phases/dim_reduce.ml

@@ -11,7 +11,7 @@ let rec expand dims depth = function
     | [node]   -> dim_reduce depth node
     | hd :: tl -> let trav = dim_reduce depth in
                   let mul = Binop (Mul, trav hd, trav (List.hd dims), noloc) in
-                  Binop (Mul, mul, expand (List.tl dims) depth tl, noloc)
+                  Binop (Add, mul, expand (List.tl dims) depth tl, noloc)
 
 and dim_reduce depth = function
     | Allocate (name, dims, dec, loc) ->