[v2,5/5] sim: Initialize pbb_br_* by default

Message ID c1165417551b34fd26cb92e686baa9e988e00fd2.1664095312.git.research_trasio@irq.a4lg.com
State Superseded
Headers
Series sim: Suppress warnings if built with Clang |

Commit Message

Tsukasa OI Sept. 25, 2022, 8:42 a.m. UTC
  On the files generated by sim/common/genmloop.sh, variables pbb_br_type and
pbb_br_npc are declared uninitialized and passed to other functions in some
cases.  Despite that those are harmless, they will generate GCC warnings
("-Wmaybe-uninitialized").

This commit ensures that pbb_br_type and pbb_br_npc variables are
initialized to a harmless value.

sim/ChangeLog:

	* common/genmloop.sh: Initialize pbb_br_type and pbb_br_npc
	by default.
---
 sim/common/genmloop.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Patch

diff --git a/sim/common/genmloop.sh b/sim/common/genmloop.sh
index 1bbeb615b05..5f6456d7159 100755
--- a/sim/common/genmloop.sh
+++ b/sim/common/genmloop.sh
@@ -1167,8 +1167,8 @@  void
   SEM_PC vpc;
 #if WITH_SEM_SWITCH_FULL
   /* For communication between cti's and cti-chain.  */
-  SEM_BRANCH_TYPE pbb_br_type;
-  PCADDR pbb_br_npc;
+  SEM_BRANCH_TYPE pbb_br_type = SEM_BRANCH_UNTAKEN;
+  PCADDR pbb_br_npc = 0;
 #endif
 
 EOF
@@ -1259,8 +1259,8 @@  void
   SEM_PC vpc;
 #if WITH_SEM_SWITCH_FAST
   /* For communication between cti's and cti-chain.  */
-  SEM_BRANCH_TYPE pbb_br_type;
-  PCADDR pbb_br_npc;
+  SEM_BRANCH_TYPE pbb_br_type = SEM_BRANCH_UNTAKEN;
+  PCADDR pbb_br_npc = 0;
 #endif
 
 EOF