@@ -973,33 +973,40 @@ let trans_visitor
973
973
(lv :Ast.lval )
974
974
: (Il.cell * Ast.ty) =
975
975
976
- let rec trans_slot_lval_full (initializing :bool ) lv =
976
+ let rec trans_slot_lval_full (initializing :bool ) ( outermost :bool ) lv =
977
977
let (cell, ty) =
978
978
match lv with
979
979
Ast. LVAL_ext (base , comp ) ->
980
980
let (base_cell, base_ty) =
981
- trans_slot_lval_full initializing base
981
+ trans_slot_lval_full initializing false base
982
982
in
983
983
trans_slot_lval_ext initializing base_ty base_cell comp
984
984
985
- | Ast. LVAL_base nbi ->
985
+ | Ast. LVAL_base _ ->
986
986
let sloti = lval_base_to_slot cx lv in
987
987
let cell = cell_of_block_slot sloti.id in
988
988
let ty = slot_ty sloti.node in
989
989
let cell = deref_slot initializing cell sloti.node in
990
- let dctrl =
991
- (* If this fails, type didn't visit the lval, and we
992
- * don't know whether to auto-deref its base. Crashing
993
- * here is best. Compiler bug.
994
- *)
995
- match htab_search cx.ctxt_auto_deref_lval nbi.id with
996
- None ->
997
- bugi cx nbi.id
998
- " Lval without auto-deref info; bad typecheck?"
999
- | Some true -> DEREF_all_boxes
1000
- | Some false -> DEREF_none
1001
- in
1002
- deref_ty dctrl initializing cell ty
990
+ (cell, ty)
991
+ in
992
+ let (cell, ty) =
993
+ if outermost
994
+ then
995
+ let id = lval_base_id lv in
996
+ let dctrl =
997
+ (* If this fails, type didn't visit the lval, and we
998
+ * don't know whether to auto-deref the entire lval.
999
+ * Crashing here is best. Compiler bug.
1000
+ *)
1001
+ match htab_search cx.ctxt_auto_deref_lval id with
1002
+ None ->
1003
+ bugi cx id
1004
+ " Lval without auto-deref info; bad typecheck?"
1005
+ | Some true -> DEREF_all_boxes
1006
+ | Some false -> DEREF_none
1007
+ in
1008
+ deref_ty dctrl initializing cell ty
1009
+ else (cell, ty)
1003
1010
in
1004
1011
iflog
1005
1012
begin
@@ -1013,7 +1020,7 @@ let trans_visitor
1013
1020
1014
1021
in
1015
1022
if lval_is_slot cx lv
1016
- then trans_slot_lval_full initializing lv
1023
+ then trans_slot_lval_full initializing true lv
1017
1024
else
1018
1025
if initializing
1019
1026
then err None " init item"
0 commit comments