Fix crash with interrupt attribute on ARM.

An indirect call has no associated function declaration.

llvm-svn: 297694
This commit is contained in:
Eli Friedman 2017-03-14 00:18:29 +00:00
parent f978743907
commit f5f1762ac6
2 changed files with 6 additions and 1 deletions

View File

@ -5387,7 +5387,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
// but can be very challenging to debug.
if (auto *Caller = getCurFunctionDecl())
if (Caller->hasAttr<ARMInterruptAttr>())
if (!FDecl->hasAttr<ARMInterruptAttr>())
if (!FDecl || !FDecl->hasAttr<ARMInterruptAttr>())
Diag(Fn->getExprLoc(), diag::warn_arm_interrupt_calling_convention);
// Promote the function operand.

View File

@ -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}}
}