-
Notifications
You must be signed in to change notification settings - Fork 445
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
Writes to a header field implicitly read the header valid bit #2891
Conversation
@fruffy this is a subtle issue of semantics that you may want to revise in Gauntlet too. |
The fix is in the def-use analysis: when someone assigns to |
How does this relate to #2323? The discussion in this issue prompted me to implicitly propagate in Gauntlet, too |
@@ -0,0 +1,59 @@ | |||
#include <core.p4> |
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.
We should probably find a way to fail tests if they are missing their reference file, so that they do not have to be added in later pull requests.
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.
I will file a new issue for that.
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.
For example, looking at the copy propagation of programs such as header-bmv2.p4 control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) {
@name("ingress.c.tmp") hdr c_tmp;
apply {
c_tmp.setInvalid();
c_tmp.f = h.h.f + 32w1;
h.h.f = c_tmp.f;
sm.egress_spec = 9w0;
}
} control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) {
@name("ingress.c.tmp") hdr c_tmp;
apply {
c_tmp.setInvalid();
c_tmp.f = h.h.f + 32w1;
h.h.f = h.h.f + 32w1;
sm.egress_spec = 9w0;
}
} This is still acceptable behavior, right? Since |
I think propagating through invalid header field is a legal behavior. The result is undefined anyway, and this is as undefined as anything else. But I also think that here we are fixing a true bug; the programs before and after were not equivalent. |
Yes, the copy propagation does something that is acceptable. Both the input and output programs have the same undefined behaviors. |
This upcoming PR will help catch many undefined programs: #2881 |
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.
Sounds good. I tightened the semantics of Gauntlet accordingly. It reports a lot more issues with undefined behavior now, but those are all benign. The only real issue that is detected is fixed with this pull request. Once it is merged in I will update the tool.
Fixes #2890