From 0ce7b4efb0e86281b4aaece0bed25c2287bd7109 Mon Sep 17 00:00:00 2001 From: Adrien Guatto Date: Sat, 2 Oct 2010 13:17:12 +0200 Subject: [PATCH] Cgen: proper assignments from constant variables. --- compiler/obc/c/cgen.ml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/obc/c/cgen.ml b/compiler/obc/c/cgen.ml index cdae0d9..a722e23 100644 --- a/compiler/obc/c/cgen.ml +++ b/compiler/obc/c/cgen.ml @@ -397,6 +397,9 @@ let generate_function_call var_env obj_env outvl objn args = (** Create the statement dest = c where c = v^n^m... *) let rec create_affect_const var_env dest c = match c.se_desc with + | Svar ln -> + let se = Static.simplify QualEnv.empty (find_const ln).c_value in + create_affect_const var_env dest se | Sarray_power(c, n) -> let x = gen_symbol () in [Cfor(x, 0, int_of_static_exp n,