diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2015-11-09 17:03:47 +0100 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2015-11-09 17:03:47 +0100 |
commit | 35e3f39bf967c4ed2ba3390b488604554306065d (patch) | |
tree | 6ec4f40aab63e818693786145de937ef7a2870eb /cparser/Bitfields.ml | |
parent | e79e6fe5e4da4cf4c9852456f5ad82e633551cc9 (diff) | |
download | compcert-35e3f39bf967c4ed2ba3390b488604554306065d.tar.gz compcert-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/Bitfields.ml')
-rw-r--r-- | cparser/Bitfields.ml | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cparser/Bitfields.ml b/cparser/Bitfields.ml index 223ee3ca..bbc39456 100644 --- a/cparser/Bitfields.ml +++ b/cparser/Bitfields.ml @@ -502,7 +502,7 @@ and transf_post env ctx op e1 bf tyfield = and transf_init env i = match i with | Init_single e -> Init_single (transf_exp env Val e) - | Init_array il -> Init_array (List.map (transf_init env) il) + | Init_array il -> Init_array (List.rev (List.rev_map (transf_init env) il)) | Init_struct(id, fld_init_list) -> let fld_init_list' = List.map (fun (f, i) -> (f, transf_init env i)) fld_init_list in |