From 9fda0b9125febc91d696243a1a9a47e114884d0a Mon Sep 17 00:00:00 2001 From: Alasdair Date: Thu, 1 Feb 2024 17:36:23 +0000 Subject: [PATCH] Fix bitfield generation with -strict_var --- src/lib/bitfield.ml | 2 +- test/typecheck/pass/issue434.sail | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 test/typecheck/pass/issue434.sail diff --git a/src/lib/bitfield.ml b/src/lib/bitfield.ml index 4d3d7029c..72458cadf 100644 --- a/src/lib/bitfield.ml +++ b/src/lib/bitfield.ml @@ -204,7 +204,7 @@ let register_field_setter typ_name field order range = String.concat "\n" [ Printf.sprintf "function %s (r_ref, v) = {" fun_id; - " r = __deref(r_ref);"; + " let r = __deref(r_ref);"; Printf.sprintf " (*r_ref) = %s(r, v)" update_fun_id; "}"; ] diff --git a/test/typecheck/pass/issue434.sail b/test/typecheck/pass/issue434.sail new file mode 100644 index 000000000..610e04f81 --- /dev/null +++ b/test/typecheck/pass/issue434.sail @@ -0,0 +1,9 @@ +default Order dec + +$include + +$option -strict_var + +bitfield b : bits(64) = { + B : 0 +}