diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -14493,7 +14493,7 @@ FunctionScopeInfo *FSI = getCurFunction(); FunctionDecl *FD = dcl ? dcl->getAsFunction() : nullptr; - if (FSI->UsesFPIntrin && !FD->hasAttr()) + if (FSI->UsesFPIntrin && FD && !FD->hasAttr()) FD->addAttr(StrictFPAttr::CreateImplicit(Context)); sema::AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();