-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Wrong MC/DC code generation with ternary operator #78453
Comments
@llvm/issue-subscribers-clang-codegen Author: NAKAMURA Takumi (chapuni)
(https://godbolt.org/z/qYKKnvbva)
```
bool foo(bool a, bool b, bool c, bool d, bool e) {
return (a || b ? c && d : e);
}
```
This is not rejected (as unsupported) but wrong code is generated. |
Seems this is generic to split decisions, like Can I retitle? |
The temporary bitmap value for the ternary operator's condition was being saved after its LHS and RHS was evaluated, which means that if the LHS or RHS has a boolean expression, the bitmap value will become corrupted, and the bitmaps for all of the boolean expressions will be wrong. The fix is to ensure that the temporary bitmap value for the ternary operator's condition is saved prior to visiting the LHS and RHS. It's a straightforward fix, but I'll put up a PR soon. |
…and RHS This is a fix for MC/DC issue llvm#78453 in which a ConditionalOperator that evaluates a complex condition was incorrectly updating its global bitmap after visiting its LHS and RHS children. This was wrong because if the LHS or RHS also evaluate a complex condition, the MCDC temporary bitmap value will get corrupted. The fix is to ensure that the bitmap is updated prior to visiting the LHS and RHS.
…re visiting children (#78814) This is a fix for MC/DC issue #78453 in which a ConditionalOperator that evaluates a complex condition was incorrectly updating its global bitmap after visiting its LHS and RHS children. This was wrong because if the LHS or RHS also evaluate a complex condition, the MCDC temporary bitmap value will get corrupted. The fix is to ensure that the bitmap is updated prior to visiting the LHS and RHS.
Thanks! |
(https://godbolt.org/z/qYKKnvbva)
This is not rejected (as unsupported) but wrong code is generated.
CoverageGen emits a couple of decisions but CodeGen emits weird code.
Finally,
llvm-cov
crashes with unexpected test vector.The text was updated successfully, but these errors were encountered: