You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vlstill opened this issue
Jan 15, 2025
· 0 comments
Assignees
Labels
coreTopics concerning the core segments of the compiler (frontend, midend, parser)p4-specTopics related to the P4 specification (https://github.com/p4lang/p4-spec/).
Values with a type introduced by the type keyword provide only a few operations:
assignment to left-values of the same type
comparisons for equality and inequality if the original type supported such comparisons
casts to and from the original type
The rationale is probably quite simple -- these type (introduced by type) should be distinguishable from their underlying types. In part to actually protect against uses like these, where the type can be accidentally used in an arithmetic operation, possibly yielding unexpected result.
I think we should reject this code, but it is a breaking change that might require P4 programmers to work around it.
The text was updated successfully, but these errors were encountered:
vlstill
added
core
Topics concerning the core segments of the compiler (frontend, midend, parser)
p4-spec
Topics related to the P4 specification (https://github.com/p4lang/p4-spec/).
labels
Jan 15, 2025
coreTopics concerning the core segments of the compiler (frontend, midend, parser)p4-specTopics related to the P4 specification (https://github.com/p4lang/p4-spec/).
In process of fixing #5094, I noticed that there are testdata/p4_16_samples/psa-dpdk-binary-operations.p4 which have shift by a type that is introduced by
type
:By the spec, this should not be accepted (8.23. Operations on types introduced by type)
The rationale is probably quite simple -- these type (introduced by
type
) should be distinguishable from their underlying types. In part to actually protect against uses like these, where the type can be accidentally used in an arithmetic operation, possibly yielding unexpected result.I think we should reject this code, but it is a breaking change that might require P4 programmers to work around it.
The text was updated successfully, but these errors were encountered: