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

offset() works with incompatible iterators when used with lists/&parse-[at|from] #1478

Closed
bbannier opened this issue Jul 5, 2023 · 0 comments · Fixed by #1532
Closed

offset() works with incompatible iterators when used with lists/&parse-[at|from] #1478

bbannier opened this issue Jul 5, 2023 · 0 comments · Fixed by #1532
Assignees
Labels
Bug Something isn't working Codegen Priority High

Comments

@bbannier
Copy link
Member

bbannier commented Jul 5, 2023

While working on #1475 I noticed that offset() seems to return incorrect results, even after pulling out the incorrect changes from #1439. The following reproducer (derived from the test added in #1477) fails in all versions down to v1.2.0.

# @TEST-EXEC: spicyc -dj %INPUT -o foo.hlto
# @TEST-EXEC: ${SCRIPTS}/printf 'FF\x01\x02' | spicy-driver foo.hlto >output 2>&1
# @TEST-EXEC: btest-diff output

module foo;

public type X = unit {
    : bytes &size=2; # FF
    : Y;
};

type Y = unit {
    payload: bytes &eod;
    : uint8[2] &parse-from=self.payload foreach { print self.offset(); }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Codegen Priority High
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant