aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Pinski <quic_apinski@quicinc.com>2025-02-06 15:59:41 -0800
committerAndrew Pinski <quic_apinski@quicinc.com>2025-02-07 06:28:32 -0800
commitea4278b1ced4a4c982678094e98ef3efd844917a (patch)
tree4643c7149f0d351dae7084fcaac08f8ab61e2942 /gcc
parent5fdcbe487df139dca2f8e6af5599edb470de8ad9 (diff)
downloadgcc-ea4278b1ced4a4c982678094e98ef3efd844917a.zip
gcc-ea4278b1ced4a4c982678094e98ef3efd844917a.tar.gz
gcc-ea4278b1ced4a4c982678094e98ef3efd844917a.tar.bz2
aarch64: Fix bootstrap with --enable-checking=release [PR118771]
With release checking we get an uninitialization warning inside aarch64_split_move because of jump threading for the case of `npieces==0` but `npieces` is never 0 (but there is no way the compiler can know that. So this fixes the issue by adding a `gcc_assert` to the function which asserts that `npieces > 0` and fixes the uninitialization warning. Bootstrapped and tested on aarch64-linux-gnu (with and without --enable-checking=release). The warning: aarch64.cc: In function 'void aarch64_split_move(rtx, rtx, machine_mode)': aarch64.cc:3418:31: error: '*(rtx_def**)((char*)&dst_pieces + offsetof(auto_vec<rtx_def*, 4>,auto_vec<rtx_def*, 4>::m_data[0]))' may be used uninitialized [-Werror=maybe-uninitialized] 3418 | if (reg_overlap_mentioned_p (dst_pieces[0], src)) | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~ aarch64.cc:3408:20: note: 'dst_pieces' declared here 3408 | auto_vec<rtx, 4> dst_pieces, src_pieces; | ^~~~~~~~~~ PR target/118771 gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_split_move): Assert that npieces is greater than 0. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/aarch64/aarch64.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index c1e4020..f5f23f6 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -3407,6 +3407,9 @@ aarch64_split_move (rtx dst, rtx src, machine_mode single_mode)
GET_MODE_SIZE (single_mode)).to_constant ();
auto_vec<rtx, 4> dst_pieces, src_pieces;
+ /* There should be at least one piece. */
+ gcc_assert (npieces > 0);
+
for (unsigned int i = 0; i < npieces; ++i)
{
auto off = i * GET_MODE_SIZE (single_mode);