-
Notifications
You must be signed in to change notification settings - Fork 444
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
Fixing bug for ParserUnroll application to a p4 program with a header union #3121
Fixing bug for ParserUnroll application to a p4 program with a header union #3121
Conversation
midend/parserUnroll.cpp
Outdated
if (element->is<IR::ArrayIndex>()) { | ||
const IR::Expression* left = element->to<IR::ArrayIndex>()->left; | ||
if (left->type->is<IR::Type_Stack>()) | ||
return left->type->to<IR::Type_Stack>()->elementType; | ||
} | ||
return typeMap->getType(element, true); | ||
auto* currentType = typeMap->getType(element); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can it happen that type information is missing here? Is this a problem with type inference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with right part of the assignment. If element is hdr.h[0].i1.index then typeMap->getType(element) returns nullptr.
The right solution is to fix the evaluation of expressions with type headerunion in the symbolic interpreter. |
The getTypeArray function is not a part of the interpreter and It doesn't take part in a calculation process. #3063 contains changes for support header union in a evaluation process. I think that is a some particular case for support of header union. |
Now that #3063 has been merged what is the status of this pull request? |
@mbudiu-vmw Do you have any comments on this pull request? |
Yes, I have requested changes which have not been carried out. |
Could, you, please, specify them? |
What is the status of this PR? |
As far as I understood we are waiting for solving the issue with the description of header union in p4lang here. It was opened two years ago. It looks like we are stuck here. |
The compiler should usually be ahead of the spec - this helps us make sure that the spec is right. |
@mbudiu-vmw, Could you, please, make a review again? |
This PR contains only test cases, is this intended? |
I would like to add an additional test for header union stacks. |
These small changes allow to use ParserUnroll class for the programs with header unions.