From: Eli Friedman Date: Tue, 14 Mar 2017 00:18:29 +0000 (+0000) Subject: Fix crash with interrupt attribute on ARM. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=370e396b7267af8a7ac0d84f847029a590d638a6;p=clang Fix crash with interrupt attribute on ARM. An indirect call has no associated function declaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297694 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 88f32bb6b3..c5b2e1b3a2 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -5387,7 +5387,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, // but can be very challenging to debug. if (auto *Caller = getCurFunctionDecl()) if (Caller->hasAttr()) - if (!FDecl->hasAttr()) + if (!FDecl || !FDecl->hasAttr()) Diag(Fn->getExprLoc(), diag::warn_arm_interrupt_calling_convention); // Promote the function operand. diff --git a/test/Sema/arm-interrupt-attr.c b/test/Sema/arm-interrupt-attr.c index cd67278d94..3a6cdbe0e0 100644 --- a/test/Sema/arm-interrupt-attr.c +++ b/test/Sema/arm-interrupt-attr.c @@ -28,3 +28,8 @@ __attribute__((interrupt("IRQ"))) void caller2() { callee1(); // expected-warning {{call to function without interrupt attribute could clobber interruptee's VFP registers}} callee2(); } + +void (*callee3)(); +__attribute__((interrupt("IRQ"))) void caller3() { + callee3(); // expected-warning {{call to function without interrupt attribute could clobber interruptee's VFP registers}} +}