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

Continue does not jump to correct point in loop #106

Open
andrewchambers opened this issue Dec 15, 2023 · 2 comments
Open

Continue does not jump to correct point in loop #106

andrewchambers opened this issue Dec 15, 2023 · 2 comments

Comments

@andrewchambers
Copy link

andrewchambers commented Dec 15, 2023

BEGIN {
	for (i = 0 ; i < 10 ; i += 1) {
		if (1)
			continue;
	}
	print("ok")
}
$ awk -f bug.awk
ok
$ frawk -f bug.awk
# infinite loop.
@ghuls
Copy link
Contributor

ghuls commented Oct 18, 2024

It looks more that frawk does not execute the update condition for the next iteration of the loop:

frawk '
BEGIN {
    for (i = 0 ; i < 10 ; i += 1) {
        print i;
        if ( i == 5 ) {
            continue;
        }
    }
    print "OK";
}' | head -n 20
0
1
2
3
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5

@andrewchambers
Copy link
Author

@ezrosent I believe the bug is in cfg.rs where make_loop seems to be disregarding the update statement. To me it looks as though it should be pushing the update statement as a loop context but it is not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants