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

"Compiler Bug Null stat" also triggered in action properties #2266

Closed
fruffy opened this issue Mar 25, 2020 · 7 comments · Fixed by #2820
Closed

"Compiler Bug Null stat" also triggered in action properties #2266

fruffy opened this issue Mar 25, 2020 · 7 comments · Fixed by #2820
Assignees
Labels
bug This behavior is unintended and should be fixed. fixed This topic is considered to be fixed.

Comments

@fruffy
Copy link
Collaborator

fruffy commented Mar 25, 2020

PR #2259 does not catch function calls in action arguments. Are there any other table properties where this could occur?

2258b.p4.txt

@fruffy fruffy changed the title "Compiler Bug Null stat" also trigger in action properties "Compiler Bug Null stat" also triggered in action properties Mar 25, 2020
@mihaibudiu mihaibudiu added the bug This behavior is unintended and should be fixed. label Mar 26, 2020
@mihaibudiu mihaibudiu self-assigned this Mar 26, 2020
@boblytton
Copy link
Contributor

Should you be allowed a function call in a binary op?

bit<16> f1() {
    return 1;
}
bit<16> f2(in bit<16> val) {
    return f1() +val;  // **Need to out of line the call**
}
control Widget(...) {
    apply {
        thingy = f2(f1()); // **Need to out of line argument creation**
    }
}

@jafingerhut
Copy link
Contributor

@boblytton I believe this has been allowed by the language specification for quite some time now. Section 8.1 "Expression evaluation order" specifies the order of evaluation, in case sub-expressions of an expression can have side effects. Do you see anything in that section that is missing, or ambiguous in some way?

@boblytton
Copy link
Contributor

Hi @jafingerhut, sorry I should have been more specific, the front-end hits BUG_CHECK() in the example above.

@jafingerhut
Copy link
Contributor

@boblytton I tried a couple of variations of the code you described with the latest master version of p4c as of now (2020-Apr-30), but did not experience any Compiler Bug messages or errors of any kind. If you can reproduce a BUG_CHECK() call, can you create a separate p4c issue with the exact program, command line, and output of p4c --version that you used?

@boblytton
Copy link
Contributor

@jafingerhut, I am still trying to track down where my issue is arising from, but as you say the latest p4c does not exhibit them - sorry for being too hasty.

@boblytton
Copy link
Contributor

boblytton commented May 4, 2020

The root of my problem was disabling 'frontend side-effect ordering'. Cheers.

@mihaibudiu
Copy link
Contributor

A spec change could be the solution, outlawing such programs.
p4lang/p4-spec#852

@mihaibudiu mihaibudiu added the fixed This topic is considered to be fixed. label Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This behavior is unintended and should be fixed. fixed This topic is considered to be fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants