[clang] [Clang][CodeGen][Sema] Fix crash when compiling naked lambdas (PR #165524)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 31 14:17:07 PDT 2025
================
@@ -2332,6 +2332,20 @@ ExprResult Sema::BuildLambdaExpr(SourceLocation StartLoc,
maybeAddDeclWithEffects(LSI->CallOperator);
}
+ // This is for GCC compatibility. If any lambda captures are actually used in the
+ // function body. GCC silently removes the naked attribute when captures are
----------------
efriedma-quic wrote:
Regardless of what gcc does here, silently ignoring the naked attribute is not acceptable: the result will almost certainly be broken.
Probably simplest to just reject any usage of naked with captures; if gcc's behavior is broken, probably nobody is using it.
https://github.com/llvm/llvm-project/pull/165524
More information about the cfe-commits
mailing list