Fix #5042: Allow non-constant args for directionless action params in tables#5465
Open
devalgupta404 wants to merge 2 commits intop4lang:mainfrom
Open
Fix #5042: Allow non-constant args for directionless action params in tables#5465devalgupta404 wants to merge 2 commits intop4lang:mainfrom
devalgupta404 wants to merge 2 commits intop4lang:mainfrom
Conversation
dc2e8d2 to
d7e02b9
Compare
Signed-off-by: devalgupta404 <devalgupta4@gmail.com>
Signed-off-by: devalgupta404 <devalgupta4@gmail.com>
d7e02b9 to
18c7f9e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5042
Per P4 Spec Section 6.8, directionless action parameters should behave as
inwhen values are provided by the P4 program, and need not be compile-time known values.The Problem
The compiler incorrectly rejected valid P4 code:
The Fix
Removed the incorrect compile-time constant check for directionless parameters in actionCall() when used in table default_action or entries.
File: frontends/p4/typeChecking/typeCheckExpr.cpp:1895-1898
Testing
Before fix:
$ ./build/p4test testdata/p4_16_samples/issue5042.p4
error: meta.x: action argument must be a compile-time constant
After fix:
$ ./build/p4test testdata/p4_16_samples/issue5042.p4
$ echo $?
0
Regression test:
$ ctest -R "p4_16_samples" -j4
96% tests passed, 1529 of 1598
All 1301 p4 label tests passed. The 69 failures are pre-existing ebpf/ubpf backend issues unrelated to this change.