aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/PackedStructs.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2015-11-09 17:03:47 +0100
committerXavier Leroy <xavier.leroy@inria.fr>2015-11-09 17:03:47 +0100
commit35e3f39bf967c4ed2ba3390b488604554306065d (patch)
tree6ec4f40aab63e818693786145de937ef7a2870eb /cparser/PackedStructs.ml
parente79e6fe5e4da4cf4c9852456f5ad82e633551cc9 (diff)
downloadcompcert-kvx-35e3f39bf967c4ed2ba3390b488604554306065d.tar.gz
compcert-kvx-35e3f39bf967c4ed2ba3390b488604554306065d.zip
Handle large static initializers for global arrays
Use tail-recursive operations to implement transformations on initializers for global arrays. This way, very large static initializers no longer cause stack overflows at compile-time.
Diffstat (limited to 'cparser/PackedStructs.ml')
-rw-r--r--cparser/PackedStructs.ml2
1 files changed, 1 insertions, 1 deletions
diff --git a/cparser/PackedStructs.ml b/cparser/PackedStructs.ml
index c163989e..6ea5d121 100644
--- a/cparser/PackedStructs.ml
+++ b/cparser/PackedStructs.ml
@@ -360,7 +360,7 @@ let transf_init loc env i =
match unroll env ty with
| TArray(ty_elt, _, _) -> Some ty_elt
| _ -> assert false in
- Init_array (List.map (trinit swap_elt) il)
+ Init_array (List.rev (List.rev_map (trinit swap_elt) il))
| Init_struct(id, fld_init_list) ->
let trinit_field (f, i) =
let swap_f =