From 92db4bbf799c26d12132637520bec5f0bc90c7f6 Mon Sep 17 00:00:00 2001
From: Valentin Perrelle <valentin.perrelle@cea.fr>
Date: Mon, 16 Sep 2019 16:49:25 +0200
Subject: [PATCH] [Dive] Fix return expression dependency values

---
 src/plugins/dive/build.ml                                | 4 ++--
 src/plugins/dive/tests/dive/oracle/assigned_param.dot    | 3 ++-
 .../dive/tests/dive/oracle/callstack_strategy.dot        | 6 ++++--
 src/plugins/dive/tests/dive/oracle/const.dot             | 3 ++-
 src/plugins/dive/tests/dive/oracle/per_callstack.dot     | 9 ++++++---
 src/plugins/dive/tests/dive/oracle/pointed_param.dot     | 9 ++++++---
 6 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/src/plugins/dive/build.ml b/src/plugins/dive/build.ml
index eaa3bbd6bfd..29a2d31b66b 100644
--- a/src/plugins/dive/build.ml
+++ b/src/plugins/dive/build.ml
@@ -398,9 +398,9 @@ let build_node_deps context node =
 
   and build_return_deps callstack stmt args kf =
     match Kernel_function.find_return kf with
-    | {skind = Return (Some {enode = Lval lval_res},_)} ->
+    | {skind = Return (Some {enode = Lval lval_res},_)} as return_stmt ->
       let callstack = Callstack.push (kf,stmt) callstack in
-      build_lval_deps callstack stmt Data lval_res
+      build_lval_deps callstack return_stmt Data lval_res
     | _ -> assert false (* Cil invariant *)
     | exception Kernel_function.No_Statement ->
       (* the function is only a prototype *)
diff --git a/src/plugins/dive/tests/dive/oracle/assigned_param.dot b/src/plugins/dive/tests/dive/oracle/assigned_param.dot
index 94e9d61fcfc..ad2fec86899 100644
--- a/src/plugins/dive/tests/dive/oracle/assigned_param.dot
+++ b/src/plugins/dive/tests/dive/oracle/assigned_param.dot
@@ -1,6 +1,7 @@
 digraph G {
   cp0 [label=<w>, shape=box, ];
-  cp1 [label=<x>, shape=box, ];
+  cp1 [label=<x>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
+       style="filled", ];
   cp3 [label=<z>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
        style="filled", ];
   cp5 [label=<x>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
diff --git a/src/plugins/dive/tests/dive/oracle/callstack_strategy.dot b/src/plugins/dive/tests/dive/oracle/callstack_strategy.dot
index 0712d3f1771..2df030b6419 100644
--- a/src/plugins/dive/tests/dive/oracle/callstack_strategy.dot
+++ b/src/plugins/dive/tests/dive/oracle/callstack_strategy.dot
@@ -8,10 +8,12 @@ digraph G {
        style="filled", ];
   cp7 [label=<y>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
        style="filled", ];
-  cp9 [label=<z>, shape=box, ];
+  cp9 [label=<z>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
+       style="filled", ];
   cp11 [label=<a>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
         style="filled", ];
-  cp13 [label=<z>, shape=box, ];
+  cp13 [label=<z>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
+        style="filled", ];
   cp16 [label=<x>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
         style="filled", ];
   
diff --git a/src/plugins/dive/tests/dive/oracle/const.dot b/src/plugins/dive/tests/dive/oracle/const.dot
index 18dc1ed3ba1..db4416d80c8 100644
--- a/src/plugins/dive/tests/dive/oracle/const.dot
+++ b/src/plugins/dive/tests/dive/oracle/const.dot
@@ -1,6 +1,7 @@
 digraph G {
   cp0 [label=<res>, shape=box, ];
-  cp1 [label=<__retres>, shape=box, ];
+  cp1 [label=<__retres>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
+       style="filled", ];
   cp3 [label=<c>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
        style="filled", ];
   cp5 [label=<w>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
diff --git a/src/plugins/dive/tests/dive/oracle/per_callstack.dot b/src/plugins/dive/tests/dive/oracle/per_callstack.dot
index c9dd70c166a..f2c61f4f447 100644
--- a/src/plugins/dive/tests/dive/oracle/per_callstack.dot
+++ b/src/plugins/dive/tests/dive/oracle/per_callstack.dot
@@ -6,9 +6,12 @@ digraph G {
        style="filled", ];
   cp5 [label=<z>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
        style="filled", ];
-  cp7 [label=<y>, shape=box, ];
-  cp9 [label=<y>, shape=box, ];
-  cp11 [label=<y>, shape=box, ];
+  cp7 [label=<y>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
+       style="filled", ];
+  cp9 [label=<y>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
+       style="filled", ];
+  cp11 [label=<y>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
+        style="filled", ];
   cp13 [label=<x>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
         style="filled", ];
   cp15 [label=<x>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
diff --git a/src/plugins/dive/tests/dive/oracle/pointed_param.dot b/src/plugins/dive/tests/dive/oracle/pointed_param.dot
index c5da80a51f2..29d345ca69b 100644
--- a/src/plugins/dive/tests/dive/oracle/pointed_param.dot
+++ b/src/plugins/dive/tests/dive/oracle/pointed_param.dot
@@ -2,9 +2,12 @@ digraph G {
   cp0 [label=<y>, shape=box, ];
   cp1 [label=<tmp>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
        style="filled", ];
-  cp3 [label=<tmp>, shape=box, ];
-  cp5 [label=<tmp>, shape=box, ];
-  cp7 [label=<__retres>, shape=box, ];
+  cp3 [label=<tmp>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
+       style="filled", ];
+  cp5 [label=<tmp>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
+       style="filled", ];
+  cp7 [label=<__retres>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
+       style="filled", ];
   cp9 [label=<x>, shape=box, fillcolor="#FFBBBB", color="#FF0000",
        style="filled,dotted", ];
   
-- 
GitLab