Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bc statements have stopped working #522

Closed
briandfoy opened this issue Mar 25, 2024 · 3 comments
Closed

bc statements have stopped working #522

briandfoy opened this issue Mar 25, 2024 · 3 comments
Assignees
Labels
Priority: critical fix immediately Program: bc The bc program Type: bug an existing feature does not work

Comments

@briandfoy
Copy link
Owner

I didn't bisect to find the problem, but this started breaking with #517. I caught up the rest of the tests for that change, but these are breaking for other reasons. Maybe the print is broken:

$ bc -e 'for ( v=0; v<5; v++) { print v; if (v>2) break }; print "\n"'
0123

$ perl bin/bc
for ( v=0; v<5; v++) { print v; if (v>2) break }; print "\n"
0

@mknos can you look at this? I can make these tests TODO, but I'd rather fix them so we can make a release.

@briandfoy briandfoy added Type: bug an existing feature does not work Priority: high work on this first Program: bc The bc program labels Mar 25, 2024
@mknos
Copy link
Contributor

mknos commented Mar 26, 2024

Thanks for the notification. The commit added for =v instruction caused the loop to terminate because $return=1 breaks out of a group statement. Setting $return=3 as done in FOR-COND fixes this for a basic loop.
However, the example loop with "break" incorrectly printed 01230 with older version of bc. The extra 0 was added by "break". Setting $return=1 as done in RETURN fixes this.
I've added these changes as separate commits in PR523.
It would be good to create some symbolic constants with helpful names for these $return values instead of 0, 1, 2, 3.

@briandfoy briandfoy added Priority: critical fix immediately and removed Priority: high work on this first labels Apr 11, 2024
@briandfoy
Copy link
Owner Author

Noting #523 for the cross-reference. (Type # followed by number to refer to another issue in the same repo)

@briandfoy
Copy link
Owner Author

The t/bc/input.t is still failing for the while statement. @mknos, can you look at that test?

 % perl -Ilib t/bc/input.t

Also, it looks like I had made some modulo tests TODO, but I forget why.

At the moment, this is blocking the next release. If we can't figure this out, I might need to come up with a different plan that reverts bc for a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: critical fix immediately Program: bc The bc program Type: bug an existing feature does not work
Projects
None yet
Development

No branches or pull requests

2 participants