From: Jeff Law Date: Sun, 9 Jun 2024 15:17:55 +0000 (-0600) Subject: [committed] [RISC-V] Fix false-positive uninitialized variable X-Git-Tag: releases/gcc-14.3.0~226 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cdb987e977e03ba78a8a0e094967a5121e01f2ce;p=thirdparty%2Fgcc.git [committed] [RISC-V] Fix false-positive uninitialized variable 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". --- diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index f4a3b96745b..fe9c8085551 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -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