From 640c7f89f0855220f2fd18fb6fa992b463458279 Mon Sep 17 00:00:00 2001
From: clc5q <clc5q@git.zephyr-software.com>
Date: Mon, 7 Dec 2015 13:26:55 +0000
Subject: [PATCH] Handle HALT instruction lack of fall-through properly in
 SMPFunction::SetLinks().

Former-commit-id: 0bfaa86e2c63179454871d007b189ea03d2b5f09
---
 src/base/SMPFunction.cpp | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/base/SMPFunction.cpp b/src/base/SMPFunction.cpp
index 0eadc8e8..27b6cc7e 100644
--- a/src/base/SMPFunction.cpp
+++ b/src/base/SMPFunction.cpp
@@ -6325,9 +6325,16 @@ void SMPFunction::SetLinks(void) {
 		}
 
 		// Last instruction in block; set successors
-		bool CallFlag = (CALL == CurrInst->GetDataFlowType());
-		bool IndirJumpFlag = (INDIR_JUMP == CurrInst->GetDataFlowType());
-		bool IndirCallFlag = (INDIR_CALL == CurrInst->GetDataFlowType());
+		SMPitype FlowType = CurrInst->GetDataFlowType();
+		if (HALT == FlowType) {
+			if (DebugFlag) {
+				SMP_msg("DEBUG: SetLinks not linking successors for HALT block\n");
+			}
+			continue;
+		}
+		bool CallFlag = (CALL == FlowType);
+		bool IndirJumpFlag = (INDIR_JUMP == FlowType);
+		bool IndirCallFlag = (INDIR_CALL == FlowType);
 		// NOTE: Due to phase re-ordering, we cannot yet identify tail calls,
 		//  so CondTailCall and TailCallFlag will always be false, which is harmless.
 		//  SMPInstr::SetTailCall() will do a little cleanup later.
-- 
GitLab