From cc666cb32c9d3914a18085652784b034aad199af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwena=C3=ABl=20Delaval?= Date: Fri, 17 Mar 2017 15:18:31 +0100 Subject: [PATCH] Bug correction in init analysis Correction: nodes instances must have well initialized inputs. --- compiler/heptagon/analysis/initialization.ml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/compiler/heptagon/analysis/initialization.ml b/compiler/heptagon/analysis/initialization.ml index 31ea9ed..0c5312a 100644 --- a/compiler/heptagon/analysis/initialization.ml +++ b/compiler/heptagon/analysis/initialization.ml @@ -287,12 +287,14 @@ and apply h app e_list = let ty1 = typing h e1 in let _ = typing h e2 in itype ty1 + | Enode _ -> + begin + (* for nodes, force all inputs to be initialized *) + List.iter (fun e -> initialized_exp h e) e_list; + izero + end | _ -> - if app.a_unsafe - then ( (* when unsafe force all inputs to be initialized *) - List.iter (fun e -> initialized_exp h e) e_list; izero ) - else ( - List.fold_left (fun acc e -> max acc (itype (typing h e))) izero e_list) + List.fold_left (fun acc e -> imax acc (itype (typing h e))) izero e_list and expect h e expected_ty =