aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Unblock.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2017-03-22 12:07:45 +0100
committerBernhard Schommer <bschommer@users.noreply.github.com>2017-03-24 11:59:58 +0100
commit911b89d725ea7d72d19721fe9470d9b5fd3fdc49 (patch)
tree85db955b6e35968d3edd0d7bf9c9c395add9b9a6 /cparser/Unblock.ml
parentb6b5aae1d406c200035ff7400de46eed2d88fd85 (diff)
downloadcompcert-kvx-911b89d725ea7d72d19721fe9470d9b5fd3fdc49.tar.gz
compcert-kvx-911b89d725ea7d72d19721fe9470d9b5fd3fdc49.zip
Emit line stmt after labels in general. Bug 21232
Diffstat (limited to 'cparser/Unblock.ml')
-rw-r--r--cparser/Unblock.ml16
1 files changed, 6 insertions, 10 deletions
diff --git a/cparser/Unblock.ml b/cparser/Unblock.ml
index ad68afbc..0752d8ae 100644
--- a/cparser/Unblock.ml
+++ b/cparser/Unblock.ml
@@ -212,13 +212,14 @@ let debug_scope ctx =
debug_annot 6L (empty_string :: List.rev_map integer_const ctx)
(* Add line number debug annotation if the line number changes.
- Add scope debug annotation regardless. *)
+ Labels are ignored since the code before the label can become
+ unreachable. Add scope debug annotation regardless. *)
-let add_lineno ?(case=false) ctx prev_loc this_loc s =
+let add_lineno ?(label=false) ctx prev_loc this_loc s =
if !Clflags.option_g then
sseq no_loc (debug_scope ctx)
- (if this_loc <> prev_loc && this_loc <> no_loc && not case
+ (if this_loc <> prev_loc && this_loc <> no_loc && not label
then sseq no_loc (debug_lineno this_loc) s
else s)
else s
@@ -254,10 +255,6 @@ let process_decl loc env ctx (sto, id, ty, optinit) k =
let l = local_initializer env { edesc = EVar id; etyp = ty' } init' [] in
add_inits_stmt loc l k
-let is_case = function
- | Slabel _ -> false
- | _ -> true
-
(* Simplification of blocks within a statement *)
let rec unblock_stmt env ctx ploc s =
@@ -295,9 +292,8 @@ let rec unblock_stmt env ctx ploc s =
{s with sdesc = Sswitch(expand_expr true env e,
unblock_stmt env ctx s.sloc s1)}
| Slabeled(lbl, s1) ->
- let loc,case = if is_case lbl then ploc,true else s.sloc,false in
- add_lineno ~case:case ctx ploc s.sloc
- {s with sdesc = Slabeled(lbl, unblock_stmt env ctx loc s1)}
+ add_lineno ~label:true ctx ploc s.sloc
+ {s with sdesc = Slabeled(lbl, unblock_stmt env ctx ploc s1)}
| Sgoto lbl ->
add_lineno ctx ploc s.sloc s
| Sreturn None ->