diff options
| author | Emily Maier <emily@emilymaier.net> | 2016-05-04 08:39:43 -0400 |
|---|---|---|
| committer | Christopher Li <sparse@chrisli.org> | 2017-01-27 08:53:08 -0800 |
| commit | ed73fd32736d0c945b29857be130153c81699478 (patch) | |
| tree | 547ebc4dffc3b1123fb56d627e8a91c9c3ea1aba /linearize.c | |
| parent | 2b2725ce700826e0fcd7de99a461ce75b9ffb0a6 (diff) | |
| download | sparse-dev-ed73fd32736d0c945b29857be130153c81699478.tar.gz | |
linearize: Emit C99 declarations correctly
Variables declared with C99 syntax inside a for statement should be
linearized in the loop top, rather than implicitly inside the loop body.
Signed-off-by: Emily Maier <emily@emilymaier.net>
Reviewed-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Tested-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'linearize.c')
| -rw-r--r-- | linearize.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/linearize.c b/linearize.c index c6ada1e8..1309c7dd 100644 --- a/linearize.c +++ b/linearize.c @@ -1946,7 +1946,11 @@ static pseudo_t linearize_iterator(struct entrypoint *ep, struct statement *stmt struct statement *post_statement = stmt->iterator_post_statement; struct expression *post_condition = stmt->iterator_post_condition; struct basic_block *loop_top, *loop_body, *loop_continue, *loop_end; + struct symbol *sym; + FOR_EACH_PTR(stmt->iterator_syms, sym) { + linearize_one_symbol(ep, sym); + } END_FOR_EACH_PTR(sym); concat_symbol_list(stmt->iterator_syms, &ep->syms); linearize_statement(ep, pre_statement); |
