-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[clang][CoverageMapping] "Assertion AfterLoc.isValid()
failed" during compiling switch
within statement expressions
#86998
Comments
@llvm/issue-subscribers-clang-codegen Author: Wentao Zhang (whentojump)
When a [statement expression](https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html) contains a `switch` statement during a partial struct initialization, source-based code coverage will crash. E.g.,
struct Foo foo = {
.field1 = ({
switch (123) {
case 123:
break;
}
456;
}),
}; Compiler explorer link
|
switch
within statement expressionsAfterLoc.isValid()' failed" during compiling
switch` within statement expressions
AfterLoc.isValid()' failed" during compiling
switch` within statement expressionsAfterLoc.isValid()
failed" during compiling switch
within statement expressions
The root cause is somewhat clearer and here are two refined examples: 1, 2 The more accurate triggering condition is: In AST, any region terminator (like llvm-project/clang/lib/CodeGen/CoverageMappingGen.cpp Lines 1375 to 1376 in e6c3289
However, the 2nd stmt doesn't have a valid source location and will fail some assertions in |
…sn't have valid source locations (llvm#89564) Fixes llvm#86998 (cherry picked from commit c1b6cca)
…sn't have valid source locations (llvm#89564) Fixes llvm#86998 (cherry picked from commit c1b6cca)
When a statement expression contains a
switch
statement during a partial struct initialization, source-based code coverage will crash. E.g.,Compiler explorer link
The text was updated successfully, but these errors were encountered: