let gaddress_of_ref tenv lv off : data =
let loc = M.lvar (mem_at_env tenv) lv (addr_of_ref tenv lv) in
match lv.lv_type with
| Ctype ty ->
let tr,gloc = memory_offset tenv ty (Loc loc) off in
data_load tenv tr gloc
| ty ->
begin
match off with
| TNoOffset -> Loc loc
| _ ->
let s = "[gaddress_of_ref] C offset of logic_var" in
WpLog.fatal "%s %a with a pure logic type %a"
s !Ast_printer.d_logic_var lv
!Ast_printer.d_logic_type ty
end