-
Notifications
You must be signed in to change notification settings - Fork 444
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
Unexpected "Duplicates declaration" error when P4 program contains no duplicate declarations #4883
Comments
P4C may create unused actions in the output P4 IR. For example, for P4
At first, controls inlining renames
Then
In the original reproducer above, the unused I am not sure if it is a fully correct/complete fix but the following change in
Instead of checking the modified |
@oleg-ran-amd Why does it not make their names unique? Is it because the action is unused and |
This:
Looks potentially problematic. Do we understand the logic behind the renaming rules? Looks like it might create bunch of internal names that might confuse other places as well? |
@kfcripps I did not debug that deep. It seems the unused action brakes IR and
It is important to note that (1) and (2) in the unused copy of action are the same (3) and (4) are different Even if such an action has no duplicate symbols or other problems and compilation succeeds, the output IR after the midend still contains an unused action (and there may be more such actions), which does not look right. |
@asl Yeah. |
Maybe the logic should be changed there? In order not to clash with internal identifiers? Tagging @ChrisDodd @vlstill @fruffy |
My first intuition here is to change the renaming behavior of the inlining passes. Usually, they just use the parent control/parser as prefix. It might be the safer option. |
) * Remove unused actions whose external name starts with '__' Signed-off-by: Kyle Cripps <[email protected]> * Add additional test case Signed-off-by: Kyle Cripps <[email protected]> --------- Signed-off-by: Kyle Cripps <[email protected]>
See #4900 (comment) |
…_" (p4lang#4900) * Remove unused actions whose external name starts with '__' Signed-off-by: Kyle Cripps <[email protected]> * Add additional test case Signed-off-by: Kyle Cripps <[email protected]> --------- Signed-off-by: Kyle Cripps <[email protected]>
results in:
The text was updated successfully, but these errors were encountered: