aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Schmidt <github@mschmidt.me>2023-01-11 12:21:21 +0100
committerXavier Leroy <xavier.leroy@college-de-france.fr>2023-01-23 18:11:14 +0100
commit800017c36c15774bdcc7dc5b318fa9606caa4170 (patch)
treeebe2fcf54cc3d1c8efee62d784490c42bb473e00
parent3845996aa69a8386d438265add80b5b66116eeaa (diff)
downloadcompcert-800017c36c15774bdcc7dc5b318fa9606caa4170.tar.gz
compcert-800017c36c15774bdcc7dc5b318fa9606caa4170.zip
Elaboration of compound initializers: reverse list of generated global variables
So as to respect dependency order when compound initializers are nested. Fixes: #471
-rw-r--r--cparser/Unblock.ml2
1 files changed, 1 insertions, 1 deletions
diff --git a/cparser/Unblock.ml b/cparser/Unblock.ml
index 32e09399..8a34db30 100644
--- a/cparser/Unblock.ml
+++ b/cparser/Unblock.ml
@@ -360,7 +360,7 @@ let unblock_decl env ((sto, id, ty, optinit) as d) =
| Some init ->
global_variables := [];
let init' = expand_init false env init in
- let decls = !global_variables in
+ let decls = List.rev !global_variables in
global_variables := [];
decls @ [(sto, id, ty, Some init')]