bc: fix for() to not leave data on stack

function                                             old     new   delta
zbc_parse_stmt_possibly_auto                        1665    1697     +32
zbc_vm_process                                       672     701     +29
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 61/0)               Total: 61 bytes
   text	   data	    bss	    dec	    hex	filename
 981656	    485	   7296	 989437	  f18fd	busybox_old
 981748	    485	   7296	 989529	  f1959	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2018-12-21 20:29:34 +01:00
parent 5d57bc442d
commit 19eee8ed7c
2 changed files with 38 additions and 25 deletions

View File

@ -56,6 +56,21 @@ testing "bc for(;;)" \
"2\n3\n2\n9\n" \
"" "i=2; for (;;) { 2; if(--i==0) break; 3; }; 9"
testing "bc for (;cond;)" \
"bc" \
"1\n2\n3\n9\n" \
"" "i=0; for(;i<3;)++i; 9"
testing "bc for (;cond;upd)" \
"bc" \
"1\n2\n3\n9\n" \
"" "i=1; for(;i<4;i++)i; 9"
testing "bc for (init;cond;upd)" \
"bc" \
"1\n2\n3\n9\n" \
"" "for(i=1;i<4;i++)i; 9"
testing "bc define auto" \
"bc" \
"8\n9\n" \