Author: efriedma
Date: Mon Mar 13 19:18:29 2017
New Revision: 297694

URL: http://llvm.org/viewvc/llvm-project?rev=297694&view=rev
Log:
Fix crash with interrupt attribute on ARM.

An indirect call has no associated function declaration.


Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/Sema/arm-interrupt-attr.c

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=297694&r1=297693&r2=297694&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Mar 13 19:18:29 2017
@@ -5387,7 +5387,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, Na
   // 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.

Modified: cfe/trunk/test/Sema/arm-interrupt-attr.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/arm-interrupt-attr.c?rev=297694&r1=297693&r2=297694&view=diff
==============================================================================
--- cfe/trunk/test/Sema/arm-interrupt-attr.c (original)
+++ cfe/trunk/test/Sema/arm-interrupt-attr.c Mon Mar 13 19:18:29 2017
@@ -28,3 +28,8 @@ __attribute__((interrupt("IRQ"))) void c
   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}}
+}


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to