https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106661
Bug ID: 106661 Summary: possible uninitialized variable usage in store_bit_field_1 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Compiling the trunk with GCC 7.5.0 for a cross to riscv32-linux-gnu produces the following warning: In file included from /bajas/pinskia/src/toolchain-riscv/scripts/../src/gcc/coretypes.h:475:0, from /bajas/pinskia/src/toolchain-riscv/scripts/../src/gcc/expmed.cc:26: /bajas/pinskia/src/toolchain-riscv/scripts/../src/gcc/poly-int.h: In function ‘bool store_bit_field_1(rtx, poly_uint64, poly_uint64, poly_uint64, poly_uint64, machine_mode, rtx, bool, bool, bool)’: /bajas/pinskia/src/toolchain-riscv/scripts/../src/gcc/poly-int.h:1107:38: warning: ‘regnum’ may be used uninitialized in this function [-Wmaybe-uninitialized] POLY_SET_COEFF (C, r, i, NCa (a) * b.coeffs[i]); ^ /bajas/pinskia/src/toolchain-riscv/scripts/../src/gcc/expmed.cc:797:21: note: ‘regnum’ was declared here HOST_WIDE_INT regnum; ^~~~~~ I looked into the code I think the warning is correct, regnum could be uninitialized if undefined_p is true but constant_multiple_p returns false. I have not looked into if the warning happens for the trunk or why x86_64 does not get the warning.