[11/40] cpu/frv: Initialize some variables

Message ID afd7757aae21743c29f2aa4135a23b31d4959e9b.1666257885.git.research_trasio@irq.a4lg.com
State Accepted
Headers
Series sim+gdb: Suppress warnings if built with Clang (big batch 1) |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Tsukasa OI Oct. 20, 2022, 9:25 a.m. UTC
  GCC generates a warning if a variable may be used uninitialized on some
cases ("-Wmaybe-uninitialized").  Despite that this will not cause a build
failure even on the default configuration (with "--enable-werror"), it is
better to be fixed.

The cause of this warning, sim/frv/sem.c is generated by CGEN from
cpu/frv.cpu.  This commit adds initialization of some variables that caused
GCC warnings.

cpu/ChangeLog:

	* frv.cpu (cmpb): Initialize cc variable.
	(load-double-gr-u-semantics, clddu) Initialize address variable.
---
 cpu/frv.cpu | 3 +++
 1 file changed, 3 insertions(+)
  

Patch

diff --git a/cpu/frv.cpu b/cpu/frv.cpu
index cdb169eddc1..6af8c3ab347 100644
--- a/cpu/frv.cpu
+++ b/cpu/frv.cpu
@@ -4266,6 +4266,7 @@ 
      "cmpb$pack $GRi,$GRj,$ICCi_1"
      (+ pack (GRk-null) OP_00 GRi ICCi_1 OPE2_0C GRj)
      (sequence ((QI cc))
+	       (set cc 0)
 	       (set-n cc (eq (and GRi #xff000000) (and GRj #xff000000)))
 	       (set-z cc (eq (and GRi #x00ff0000) (and GRj #x00ff0000)))
 	       (set-v cc (eq (and GRi #x0000ff00) (and GRj #x0000ff00)))
@@ -4655,6 +4656,7 @@ 
 
 (define-pmacro (load-double-gr-u-semantics)
   (sequence ((WI address))
+	    (set address 0)
 	    (load-double-semantics 0 DI GR address GRj)
 	    (if (ne (index-of GRi) (index-of GRdoublek))
 		(sequence ()
@@ -5309,6 +5311,7 @@ 
      (+ pack GRdoublek OP_62 GRi CCi cond OPE4_1 GRj)
      (if (eq CCi (or cond 2))
 	 (sequence ((WI address))
+		   (set address 0)
 		   (load-double-semantics 0 DI GR address GRj)
 		   (if (ne (index-of GRi) (index-of GRdoublek))
 		       (set GRi address))))