From 3ea7ee6f0823f77641dec3839c360844a00014d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20B=C3=BChler?= <david.buhler@cea.fr>
Date: Mon, 9 Dec 2019 22:12:46 +0100
Subject: [PATCH] [Scope] Do not crash when calling "Zones" on a statement with
 no predecessor.

---
 src/plugins/scope/zones.ml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/plugins/scope/zones.ml b/src/plugins/scope/zones.ml
index 2a31ef57059..a389d0e67f3 100644
--- a/src/plugins/scope/zones.ml
+++ b/src/plugins/scope/zones.ml
@@ -336,14 +336,16 @@ let pretty fmt stmt_zones =
 
        (*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
 
-let build_zones =
+let build_zones kf stmt lval =
   (* TODO: Journal.register *)
   (* (Datatype.func Kernel_type.kernel_function
                      (Datatype.func Kernel_type.stmt
                         (Datatype.func Kernel_type.lval
                            (Datatype.couple Kernel_type.stmt_set zones_ty)))))
                            *)
-  compute
+  if stmt.preds = []
+  then Stmt.Hptset.empty, Ctx.create 0
+  else compute kf stmt lval
 
 let get_zones =
   (* TODO: Journal.register *)
-- 
GitLab