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

Constraints on types of header, struct, and stack fields #149

Open
hackedy opened this issue May 9, 2020 · 4 comments
Open

Constraints on types of header, struct, and stack fields #149

hackedy opened this issue May 9, 2020 · 4 comments

Comments

@hackedy
Copy link
Collaborator

hackedy commented May 9, 2020

https://p4.org/p4-spec/docs/P4-16-v1.2.0.html#sec-header-types

Failing tests:

  • examples/checker_tests/bad/issue407-1.p4
  • examples/checker_tests/bad/header3.p4
  • examples/checker_tests/bad/stack_e.p4
  • examples/checker_tests/bad/twovarbit.p4
@hackedy hackedy added typechecker easy This bug seems straightforward to fix. labels May 9, 2020
@hackedy hackedy self-assigned this May 12, 2020
@rudynicolop rudynicolop self-assigned this May 28, 2020
@rudynicolop
Copy link
Contributor

These tests pass now:

  • examples/checker_tests/bad/issue407-1.p4
  • examples/checker_tests/bad/header3.p4
  • examples/checker_tests/bad/stack_e.p4

However, test examples/checker_tests/bad/twovarbit.p4 still fails.

I am not sure if it is kosher or not for a header to have multiple varbit<w> fields. Section 7.2.2. Header Types does not seem to mention any such restriction for headers in general.

However, as described in Section 12.8.2. Variable width extraction, Headers passed into extract may only have up to one varbit<w> field.

Should the restriction on the number of varbit<w> fields in a header be imposed generally, or just for the case of extract?

@rudynicolop
Copy link
Contributor

Recursive headers are now verboten.

Test examples/checker_tests/bad/issue2290.p4 now passes

@hackedy
Copy link
Collaborator Author

hackedy commented Jun 19, 2020

Everything's passing except the twovarbit thing. I asked over at the p4c repo about it since it seemed like something that should get checked at extract() calls and not at header definitions: p4lang/p4c#2445

@hackedy hackedy added bad-test and removed easy This bug seems straightforward to fix. labels Jun 19, 2020
@hackedy hackedy removed their assignment Jun 19, 2020
@hackedy
Copy link
Collaborator Author

hackedy commented Jun 24, 2020

p4lang/p4-spec#876

hackedy added a commit that referenced this issue Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants