diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2017-03-23 14:02:02 +0100 |
---|---|---|
committer | Bernhard Schommer <bschommer@users.noreply.github.com> | 2017-03-24 11:59:58 +0100 |
commit | 1c153479a1fdd95e8df55afa8f337a456ae4b538 (patch) | |
tree | f05c02636df65261a918d26f32f67982d3a96ce4 /cparser/Unblock.ml | |
parent | 911b89d725ea7d72d19721fe9470d9b5fd3fdc49 (diff) | |
download | compcert-kvx-1c153479a1fdd95e8df55afa8f337a456ae4b538.tar.gz compcert-kvx-1c153479a1fdd95e8df55afa8f337a456ae4b538.zip |
Added handling if s.sloc <> s1.sloc
If the label is on a different line than the code we can still
emit a line directive for the label.
Bug 21232
Diffstat (limited to 'cparser/Unblock.ml')
-rw-r--r-- | cparser/Unblock.ml | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cparser/Unblock.ml b/cparser/Unblock.ml index 0752d8ae..91e2ce20 100644 --- a/cparser/Unblock.ml +++ b/cparser/Unblock.ml @@ -292,8 +292,12 @@ 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) -> - add_lineno ~label:true ctx ploc s.sloc - {s with sdesc = Slabeled(lbl, unblock_stmt env ctx ploc s1)} + let loc,label = if s.sloc <> s1.sloc then + s.sloc,false (* Label and code are on different lines *) + else + ploc,true in + add_lineno ~label:label ctx ploc s.sloc + {s with sdesc = Slabeled(lbl, unblock_stmt env ctx loc s1)} | Sgoto lbl -> add_lineno ctx ploc s.sloc s | Sreturn None -> |