summaryrefslogtreecommitdiff
path: root/src/ast_util.ml
diff options
context:
space:
mode:
authorAlasdair Armstrong2017-11-03 16:56:20 +0000
committerAlasdair Armstrong2017-11-03 16:56:20 +0000
commit31d548faa0388fc517f2d2ccaee894a71d29698a (patch)
tree0f34d655d78d2e57da4a3d394ef14f0e3a88c1e8 /src/ast_util.ml
parent3a90d6fa49303e148b8ee717ea74142a4972e50c (diff)
parentb93a5387d0565d0bfc452146e7335fc4b46110fa (diff)
Merge branch 'experiments' of https://bitbucket.org/Peter_Sewell/sail into experiments
Diffstat (limited to 'src/ast_util.ml')
-rw-r--r--src/ast_util.ml3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ast_util.ml b/src/ast_util.ml
index 707ec93c..7d366803 100644
--- a/src/ast_util.ml
+++ b/src/ast_util.ml
@@ -198,6 +198,9 @@ and nexp_simp_aux = function
let (Nexp_aux (n2_simp, _) as n2) = nexp_simp n2 in
match n1_simp, n2_simp with
| Nexp_constant c1, Nexp_constant c2 -> Nexp_constant (c1 - c2)
+ (* A vector range x['n-1 .. 0] can result in the size "('n-1) - -1" *)
+ | Nexp_minus (Nexp_aux (n,_), Nexp_aux (Nexp_constant c1,_)), Nexp_constant c2
+ when c1 = -c2 -> n
| _, _ -> Nexp_minus (n1, n2)
end
| nexp -> nexp