sim: Initialize pbb_br_* by default
authorTsukasa OI <research_trasio@irq.a4lg.com>
Thu, 6 Oct 2022 06:43:53 +0000 (06:43 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Tue, 11 Oct 2022 14:18:15 +0000 (15:18 +0100)
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/common/genmloop.sh

index 1bbeb615b0566460c980c49b874f3589f9959b3a..5f6456d7159eb8e9b8565ed7c3e982af18f680c0 100755 (executable)
@@ -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