-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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++ segment fault in clang::Sema::ActOnCapScopeReturnStmt #48527
Comments
Also crashes on trunk https://godbolt.org/z/v17hqr
|
Still crashing as of post-17 trunk: https://godbolt.org/z/54YrjjK6W
|
@llvm/issue-subscribers-clang-frontend |
This looks tough, so we are parsing the lambda and get to llvm-project/clang/lib/Parse/ParseDecl.cpp Line 415 in 61c44f1
I think b/c it just has to be a balance token sequence. We eventually get here: llvm-project/clang/lib/Sema/SemaStmt.cpp Lines 3947 to 3949 in 0649594
so we know we are parsing a lambda IIUC but we don't realize that being here does not make sense when parsing attribute argument list and therefore can't error out. CC @zygoloid @cor3ntin for possible advice on tackling this one |
Lambdas do not have types until after the declarator is parsed. However,
Adding if(CurLambda && CurLambda->CallOperator->getType().isNull()) {
return StmtError();
} at the very top of void test () {
struct S {
int f() __attribute__((b(({
return 0;
}
};
} |
I don't have the bandwidth to make a pr, but with the above guidance, it should be straightforward |
Hi! This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
For more instructions on how to submit a patch to LLVM, see our documentation. If you have any further questions about this issue, don't hesitate to ask via a comment on this Github issue. @llvm/issue-subscribers-good-first-issue |
[](void)__attribute__((b(({ is a lambda with no parameters and a GCC-style attribute Note that statement expressions have the value of their last statement. The following is accepted by both GCC and Clang: char *__attribute__((aligned(({ 8; })))) *f; It is unclear to me how to treat non-local control flow ( []()__attribute__((b(({ return 0; })))){}; For now, I created https://reviews.llvm.org/D159528 as per the above instructions. Should I file a GH PR instead? |
The issue is not specific to GCC-style attributes and is also reproducible with C++11 attributes. |
Yes ! |
…expr clang was crashing on a lambda attribute with a statement expression that contained a `return`. It attempted to access the lambda type which was unknown at that point. Fixes llvm#48527
…expr (llvm#66643) clang was crashing on a lambda attribute with a statement expression that contained a `return`. It attempted to access the lambda type which was unknown at that point. Fixes llvm#48527
Extended Description
The frontend fault blocks many downstream applications of clang (e.g., creduce).
Version 11.0.0 and 6.0.0 are affected.
The text was updated successfully, but these errors were encountered: