Open p-sawicki opened 6 months ago
Yeah... we have always punted this specification detail. Support for header unions and varbits is brittle. Let me see whether there is an easy way to implement it
Actually, the reason this might be modeled incorrectly is that BMv2 also has the same behavior. The test, as written, passes. If I add code to set other headers invalid I am seeing mismatches.
@antoninbas Does BMv2 model this behavior? It looks like remove_header
doesn't account for unions either?
@antoninbas The best way to handle this as of now would be for the backend to generate a remove_header
call for every header that constitutes the union.
Agreed with Antonin's assessment. The bug is in the combination of the behavior of the p4c BMv2 back end, combined with BMv2. Modifications to either (or both) of them could correct the issue.
Added an implementation in this PR: https://github.com/p4lang/p4c/pull/4853
The spec specifies that calling
setInvalid()
on any header inside a header union should invalidate all headers in that union:However, Testgen doesn't expect all the headers to be invalidated, only the one on which
setInvalid()
is called.Example source code:
Command:
Output (main_3.stf):
This emit should be invalid: