-
Notifications
You must be signed in to change notification settings - Fork 82
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
Errors in spec samples #1364
Comments
If I recall correctly (the git log on spec and p4c will tell for sure), Mihai Budiu wrote this section of the spec, and the p4c implementation for invalid headers. He may have left comments in the p4c implementation indicating reasons why this does not work. I am guessing that if the line:
has an explicit cast added to it, like so:
then there is no p4c compile-time error? |
I am guessing you considered this possibility as well, but this might be considered as a bug or limitation in the p4c implementation, rather than as a problem with the spec example. |
Let's view on the problem from slightly broader scope. Currently there is no set of P4 files that comprehensively cover all the aspects of the spec: the ones in Therefore, there is an expectation that P4C is able to compile examples from the spec. If not, it could be:
This is why I opened this issue as further resolution would be necessary:
I checked everything in h = (H){#}; Judging from p4lang/p4c#3667 (comment) it is something that likely was discussed on LDWG, so might be an oversight in spec? |
I agree with everything you wrote :-) And thank you for digging further into the history of this. Very often, unless someone else reading the issue has the full context of what was done in the past in their heads right now, this kind of digging is needed when deciding between the alternatives of "spec needs updating", "p4c has a bug/limitation", or "both of those are true". My first quick reaction for this issue is "it seems like a reasonable choice to update the spec examples to match what p4c is supporting". This quick reaction is not necessarily the prevailing view of all stakeholders. |
And if someone is interested in creating a set of test P4 programs that cover all of the code examples in the spec, and creating issues on the spec and/or p4c when there are discrepancies, that sounds like a useful project. |
Right. Though if this was something discussed at the LDWG, it would be great to check what the resolution it was. Maybe this is something know, et.c |
I was likely there if it was discussed, but given it probably happened in late 2022 I have no memory of it. The meeting notes vary in their level of detail, but you are welcome to search through them to see if you can find any notes about it. Note that there were almost certainly multiple meetings discussing several different syntaxes for invalid headers, spread over time -- that I am certain of, so it might be challenging to find the one that addressed the distinction between whether the type of |
The spec contains some samples that cannot be compiled as of now. For example, https://p4.org/p4-spec/docs/p4-16-working-draft.html#sec-ops-on-hdrs mentions:
Whereas p4c produces:
I believe I saw other issues with examples as well.
The text was updated successfully, but these errors were encountered: