[04/40] cpu/cris: Initialize some variables on CRIS CPU

Message ID 65223c79fdfd7faf132275415cd9da9852c5bec3.1666258361.git.research_trasio@irq.a4lg.com
State Committed
Series sim+gdb: Suppress warnings if built with Clang (big batch 1) |

Commit Message

Tsukasa OI Oct. 20, 2022, 9:32 a.m. UTC
  GCC / Clang generate a warning if a variable may be used uninitialized on
some cases (Clang: "-Wsometimes-uninitialized").  When the program is being
built by Clang with the default configuration, it causes a build failure
(unless "--disable-werror" is specified).

Those error occur on sim/cris/semcrisv{10,32}f-switch.c but they are
CGEN-generated files.  The real cause of this problem is in cpu/cris.cpu
which does not initialize certain variables.

This commit ensures such variables are initialized to zero by default.
Note that this commit itself does not regenerate CRIS CPU related files
with CGEN because it still has several issues preventing regeneration.
They are to be fixed in the later commits.


	* cris.cpu: Initialize condres, newval and tmpres variables.
 cpu/cris.cpu | 3 +++
 1 file changed, 3 insertions(+)


diff --git a/cpu/cris.cpu b/cpu/cris.cpu
index 97b44581e78..cd85f4e94e2 100644
--- a/cpu/cris.cpu
+++ b/cpu/cris.cpu
@@ -541,6 +541,7 @@ 
     ((SI tmpcond) (BI condres))
+    (set condres 0)
     (set tmpcond condno)
@@ -2655,6 +2656,7 @@ 
        ((SI rno) (SI newval))
        (set rno (regno Pd))
+       (set newval 0)
 	; No sanity check for constant special register here, since the
@@ -3698,6 +3700,7 @@ 
     ((SI tmpcode) (SI tmpval) (SI tmpres))
+    (set tmpres 0)
     (set tmpcode swapcode)
     (set tmpval val)