aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-08-23 20:11:18 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-08-23 20:11:18 +0200
commit10d5ed08a324ffd10d4db8ec58bbf6e77253bc36 (patch)
tree31096c66503b8eb015d0763b7aa79e7bd02f8f75 /debug
parentc879cd9abb6e5dac1bc303da1b0c11e551d8528e (diff)
downloadcompcert-kvx-10d5ed08a324ffd10d4db8ec58bbf6e77253bc36.tar.gz
compcert-kvx-10d5ed08a324ffd10d4db8ec58bbf6e77253bc36.zip
Do not add subsize tag to array types without size such as flexible array members.
Diffstat (limited to 'debug')
-rw-r--r--debug/CtoDwarf.ml24
1 files changed, 14 insertions, 10 deletions
diff --git a/debug/CtoDwarf.ml b/debug/CtoDwarf.ml
index 99b77e6f..103849d0 100644
--- a/debug/CtoDwarf.ml
+++ b/debug/CtoDwarf.ml
@@ -188,29 +188,33 @@ and fun_to_dwarf_tag rt args =
s.id,((s::others)@et)
(* Generate a dwarf tag for the given array type *)
-and array_to_dwarf_tag child size =
+and array_to_dwarf_tag child size =
+ let append_opt a b =
+ match a with
+ | None -> b
+ | Some a -> a::b in
let size_to_subrange s =
- let b = (match s with
+ match s with
| None -> None
| Some i ->
let i = Int64.to_int i in
- Some (BoundConst i)) in
- let s = {
- subrange_type = None;
- subrange_upper_bound = b;
- } in
- new_entry (DW_TAG_subrange_type s) in
+ let s =
+ {
+ subrange_type = None;
+ subrange_upper_bound = Some (BoundConst i);
+ } in
+ Some (new_entry (DW_TAG_subrange_type s)) in
let rec aux t =
(match t with
| TArray (child,size,_) ->
let sub = size_to_subrange size in
let t,c,e = aux child in
- t,sub::c,e
+ t,append_opt sub c,e
| _ -> let t,e = type_to_dwarf t in
t,[],e) in
let t,children,e = aux child in
let sub = size_to_subrange size in
- let children = List.rev (sub::children) in
+ let children = List.rev (append_opt sub children) in
let arr = {
array_type_file_loc = None;
array_type = t;