]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[committed] [RISC-V] Fix false-positive uninitialized variable
authorJeff Law <jlaw@ventanamicro.com>
Sun, 9 Jun 2024 15:17:55 +0000 (09:17 -0600)
committerKito Cheng <kito.cheng@sifive.com>
Wed, 9 Apr 2025 14:15:14 +0000 (22:15 +0800)
Andreas noted we were getting an uninit warning after the recent constant
synthesis changes.  Essentially there's no way for the uninit analysis code to
know the first entry in the CODES array is a UNKNOWN which will set X before
its first use.

So trivial initialization with NULL_RTX is the obvious fix.

Pushed to the trunk.

gcc/

* config/riscv/riscv.cc (riscv_move_integer): Initialize "x".

gcc/config/riscv/riscv.cc

index f4a3b96745b67d6734bda8d386dfacc55f96f2c8..fe9c8085551ba252e30baf0bf11ca03ef99594ad 100644 (file)
@@ -2423,7 +2423,7 @@ riscv_move_integer (rtx temp, rtx dest, HOST_WIDE_INT value,
   struct riscv_integer_op codes[RISCV_MAX_INTEGER_OPS];
   machine_mode mode;
   int i, num_ops;
-  rtx x;
+  rtx x = NULL_RTX;
 
   mode = GET_MODE (dest);
   /* We use the original mode for the riscv_build_integer call, because HImode