]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Fix an oversight in aarch64_evpc_reencode
authorPengxuan Zheng <quic_pzheng@quicinc.com>
Fri, 16 May 2025 00:52:29 +0000 (17:52 -0700)
committerPengxuan Zheng <quic_pzheng@quicinc.com>
Fri, 16 May 2025 18:22:29 +0000 (11:22 -0700)
Some fields (e.g., zero_op0_p and zero_op1_p) of the struct "newd" may be left
uninitialized in aarch64_evpc_reencode. This can cause reading of uninitialized
data. I found this oversight when testing my patches on and/fmov
optimizations. This patch fixes the bug by zero initializing the struct.

Pushed as obvious after bootstrap/test on aarch64-linux-gnu.

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_evpc_reencode): Zero initialize
newd.

gcc/config/aarch64/aarch64.cc

index 901aa6ea68a8d1b74c9f04223316a1eb30025907..f5552e4b86ce993dadc12fcb14e7a12add4b4530 100644 (file)
@@ -26277,7 +26277,7 @@ aarch64_evpc_trn (struct expand_vec_perm_d *d)
 static bool
 aarch64_evpc_reencode (struct expand_vec_perm_d *d)
 {
-  expand_vec_perm_d newd;
+  expand_vec_perm_d newd = {};
 
   /* The subregs that we'd create are not supported for big-endian SVE;
      see aarch64_modes_compatible_p for details.  */