diff options
-rw-r--r-- | miscutils/bc.c | 3 | ||||
-rwxr-xr-x | testsuite/dc.tests | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index aba51e5f8..9a9880706 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -6521,7 +6521,7 @@ static BC_STATUS zdc_program_execStr(char *code, size_t *bgn, bool cond) | |||
6521 | if (s || !BC_PROG_STR(n)) goto exit; | 6521 | if (s || !BC_PROG_STR(n)) goto exit; |
6522 | sidx = n->rdx; | 6522 | sidx = n->rdx; |
6523 | } else | 6523 | } else |
6524 | goto exit; | 6524 | goto exit_nopop; |
6525 | } | 6525 | } |
6526 | 6526 | ||
6527 | fidx = sidx + BC_PROG_REQ_FUNCS; | 6527 | fidx = sidx + BC_PROG_REQ_FUNCS; |
@@ -6561,6 +6561,7 @@ static BC_STATUS zdc_program_execStr(char *code, size_t *bgn, bool cond) | |||
6561 | RETURN_STATUS(BC_STATUS_SUCCESS); | 6561 | RETURN_STATUS(BC_STATUS_SUCCESS); |
6562 | exit: | 6562 | exit: |
6563 | bc_vec_pop(&G.prog.results); | 6563 | bc_vec_pop(&G.prog.results); |
6564 | exit_nopop: | ||
6564 | RETURN_STATUS(s); | 6565 | RETURN_STATUS(s); |
6565 | } | 6566 | } |
6566 | #define zdc_program_execStr(...) (zdc_program_execStr(__VA_ARGS__) COMMA_SUCCESS) | 6567 | #define zdc_program_execStr(...) (zdc_program_execStr(__VA_ARGS__) COMMA_SUCCESS) |
diff --git a/testsuite/dc.tests b/testsuite/dc.tests index 8c3af4156..f74e3f0f5 100755 --- a/testsuite/dc.tests +++ b/testsuite/dc.tests | |||
@@ -44,6 +44,16 @@ testing "dc complex without spaces (multiple args)" \ | |||
44 | optional FEATURE_DC_BIG | 44 | optional FEATURE_DC_BIG |
45 | # All tests below depend on FEATURE_DC_BIG | 45 | # All tests below depend on FEATURE_DC_BIG |
46 | 46 | ||
47 | testing "dc: x should execute strings" \ | ||
48 | "dc -e'[40 2 +] x f'" \ | ||
49 | "42\n" \ | ||
50 | "" "" | ||
51 | |||
52 | testing "dc: x should not execute or pop non-strings" \ | ||
53 | "dc -e'42 x f'" \ | ||
54 | "42\n" \ | ||
55 | "" "" | ||
56 | |||
47 | testing "dc read" \ | 57 | testing "dc read" \ |
48 | "dc -finput" \ | 58 | "dc -finput" \ |
49 | "2\n9\n1\n" \ | 59 | "2\n9\n1\n" \ |