diff options
author | Eli Friedman <efriedma@codeaurora.org> | 2017-03-14 00:18:29 +0000 |
---|---|---|
committer | Eli Friedman <efriedma@codeaurora.org> | 2017-03-14 00:18:29 +0000 |
commit | f5f1762ac6b7adc77dfcb11d0f3705ad518dc502 (patch) | |
tree | 0b81472575f7258d9c60e3ae4caf5e83edd8f587 | |
parent | f978743907a2dd9dfa3d10cec2b19977f180adcc (diff) | |
download | bcm5719-llvm-f5f1762ac6b7adc77dfcb11d0f3705ad518dc502.tar.gz bcm5719-llvm-f5f1762ac6b7adc77dfcb11d0f3705ad518dc502.zip |
Fix crash with interrupt attribute on ARM.
An indirect call has no associated function declaration.
llvm-svn: 297694
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 2 | ||||
-rw-r--r-- | clang/test/Sema/arm-interrupt-attr.c | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 88f32bb6b3b..c5b2e1b3a25 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/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<ARMInterruptAttr>()) - if (!FDecl->hasAttr<ARMInterruptAttr>()) + if (!FDecl || !FDecl->hasAttr<ARMInterruptAttr>()) Diag(Fn->getExprLoc(), diag::warn_arm_interrupt_calling_convention); // Promote the function operand. diff --git a/clang/test/Sema/arm-interrupt-attr.c b/clang/test/Sema/arm-interrupt-attr.c index cd67278d944..3a6cdbe0e07 100644 --- a/clang/test/Sema/arm-interrupt-attr.c +++ b/clang/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}} +} |