Skip to content
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

allow to call function/extern with a non-compile time known constant via an action with a directionless argument #3832

Open
apinski-cavium opened this issue Jan 10, 2023 · 0 comments
Labels
core Topics concerning the core segments of the compiler (frontend, midend, parser)

Comments

@apinski-cavium
Copy link

Found because I was implementing p4lang/p4-spec#1213 in my front-end (though there are still issues with the testsuite as p4c considers all directionless arguments as compile time know constants) and noticed pna.p4 was broken (p4lang/pna#110 is the fix there) .
Take:

extern void f(bit t);
action a(bit t)
{
  f(t);
}
control c(in bit t)
{
  apply {
    // f(t);
    a(t);
  }
}

The call into the action should be rejected even though a's t is a directionless argument, it should really be treated as an in argument.
A call to f inside c is correctly rejected while the call to a is accepted because actions directionless arguments are the same as an in direction.

@fruffy fruffy added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Topics concerning the core segments of the compiler (frontend, midend, parser)
Projects
None yet
Development

No branches or pull requests

2 participants