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

Allow usage of a typedef type in parameters of a parser for p4c-bm2-ss #3118

Closed

Conversation

VolodymyrPeschanenkoIntel
Copy link
Contributor

If we try to get a type of a header from refMap for Type_Name then It could be represented as Type_Typedef type which contains type of a header in one of it's filed.
Please, run the following command to demonstrate the problem:
./p4c-bm2-ss -o ./tmp/strength-simple.p4.json ../testdata/p4_16_samples/strength-simple.p4

Copy link
Contributor

@mihaibudiu mihaibudiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we have a pass to eliminate all typedefs from the program?

@VolodymyrPeschanenkoIntel
Copy link
Contributor Author

Don't we have a pass to eliminate all typedefs from the program?

In that case behavioral-model crashed for few examples.
For example:
1550/2217 Test #449: bmv2/testdata/p4_16_samples/ipv6-switch-ml-bmv2.p4 .............................................***Failed 0.85 sec
Error compiling
/p4c/testdata/p4_16_samples/ml-headers.p4(182): [--Werror=type-error] error: Field _egress_port1 is not a member of structure struct metadata_t
struct metadata_t {
^^^^^^^^^^
/p4c/testdata/p4_16_samples/ml-headers.p4(182): [--Werror=type-error] error: Field _fwd_out_bd69 is not a member of structure struct metadata_t
struct metadata_t {
^^^^^^^^^^
/p4c/testdata/p4_16_samples/ml-headers.p4(182): [--Werror=type-error] error: Field _fwd_out_bd69 is not a member of structure struct metadata_t
struct metadata_t {
^^^^^^^^^^

*** Test failed

But everything is correct in p4c side.

@@ -181,6 +181,8 @@ set (XFAIL_TESTS
testdata/p4_16_samples/issue1882-bmv2.p4
testdata/p4_16_samples/issue1882-1-bmv2.p4
testdata/p4_16_samples/issue2664-bmv2.p4
# typedef type as a parameters of a parser
testdata/p4_16_samples/strength-simple.p4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this test failing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that, It happens because of these two things:

  1. typedef my_headers_t headers_t;
  2. parser parser_impl(...,out headers_t hdr,...)

@mihaibudiu
Copy link
Contributor

Doesn't #3123 solve this problem?
If so, please approve that PR and close this one.

@VolodymyrPeschanenkoLitSoft
Copy link
Contributor

Implemented in #3123

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

Successfully merging this pull request may close these issues.

3 participants