Your message dated Tue, 03 Mar 2026 09:18:40 +0000
with message-id <[email protected]>
and subject line Bug#1123631: fixed in gcc-11 11.5.0-10
has caused the Debian Bug report #1123631,
regarding gcc-11: GCC produces wrong code for arm64+sve
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
1123631: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1123631
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: gcc-11
Version: 11.5.0-7
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu resolute ubuntu-patch
Dear Maintainer,
This bug causes data corruption in the ARM64 code compiled with Scalable Vector
Extensions (SVE) enabled for the 256-bit SVE processor but executed on 128-bit
SVE processors.
Example is AWS workload built for Graviton3, but executed on Graviton4.
When the compiler was compiling the ~ConstA (Not ConstA) expression to compute
the index into the vector it was actually computing -ConstA (minus ConstA),
e.g. ~4 instead of -5 produced -4.
Graviton 4 processes a 256-bit vector in two passes. For the second pass it
runs into this bug when computing indices into the second half of the vector
and ends up with {-4, -5, -6, -7}, processing the last element of the first
half twice and never touching the last element of the vector.
This data corruption may cause data loss, failing checksums, and potentially
security issues.
The upstream patch fixes the typo that caused this corruption.
In Ubuntu, the attached patch was applied to achieve the following:
* d/p/pr118976.diff: Fix memory corruption when executing 256-bit
Scalable Vector Extensions code on 128-bit CPUs (LP: #2101084).
Thanks for considering the patch.
-- System Information:
Debian Release: forky/sid
APT prefers questing-updates
APT policy: (500, 'questing-updates'), (500, 'questing-security'), (500,
'questing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.17.0-7-generic (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru gcc-11-11.5.0/debian/patches/pr118976.diff
gcc-11-11.5.0/debian/patches/pr118976.diff
--- gcc-11-11.5.0/debian/patches/pr118976.diff 1970-01-01 12:00:00.000000000
+1200
+++ gcc-11-11.5.0/debian/patches/pr118976.diff 2025-12-18 15:22:44.000000000
+1300
@@ -0,0 +1,60 @@
+From: Richard Sandiford <[email protected]>
+Date: Tue, 4 Mar 2025 10:44:35 +0000
+Subject: Fix folding of BIT_NOT_EXPR for POLY_INT_CST [PR118976]
+
+There was an embarrassing typo in the folding of BIT_NOT_EXPR for
+POLY_INT_CSTs: it used - rather than ~ on the poly_int. Not sure
+how that happened, but it might have been due to the way that
+~x is implemented as -1 - x internally.
+
+gcc/
+ PR tree-optimization/118976
+ * fold-const.cc (const_unop): Use ~ rather than - for BIT_NOT_EXPR.
+ * config/aarch64/aarch64.cc (aarch64_test_sve_folding): New function.
+ (aarch64_run_selftests): Run it.
+
+Bug-Ubuntu: https://launchpad.net/bugs/2101084
+Origin: backport,
https://gcc.gnu.org/g:78380fd7f743e23dfdf013d68a2f0347e1511550
+
+diff --git a/src/gcc/config/aarch64/aarch64.c
b/src/gcc/config/aarch64/aarch64.c
+index 391a93f30..00fc7355a 100644
+--- a/src/gcc/config/aarch64/aarch64.c
++++ b/src/gcc/config/aarch64/aarch64.c
+@@ -26136,6 +26136,16 @@ aarch64_test_fractional_cost ()
+ ASSERT_EQ (cf (1, 2).as_double (), 0.5);
+ }
+
++/* Test SVE arithmetic folding. */
++
++static void
++aarch64_test_sve_folding ()
++{
++ tree res = fold_unary (BIT_NOT_EXPR, ssizetype,
++ ssize_int (poly_int64 (1, 1)));
++ ASSERT_TRUE (operand_equal_p (res, ssize_int (poly_int64 (-2, -1))));
++}
++
+ /* Run all target-specific selftests. */
+
+ static void
+@@ -26143,6 +26153,7 @@ aarch64_run_selftests (void)
+ {
+ aarch64_test_loading_full_dump ();
+ aarch64_test_fractional_cost ();
++ aarch64_test_sve_folding ();
+ }
+
+ } // namespace selftest
+diff --git a/src/gcc/fold-const.c b/src/gcc/fold-const.c
+index 5b4053df5..cb05243bb 100644
+--- a/src/gcc/fold-const.c
++++ b/src/gcc/fold-const.c
+@@ -1791,7 +1791,7 @@ const_unop (enum tree_code code, tree type, tree arg0)
+ if (TREE_CODE (arg0) == INTEGER_CST)
+ return fold_not_const (arg0, type);
+ else if (POLY_INT_CST_P (arg0))
+- return wide_int_to_tree (type, -poly_int_cst_value (arg0));
++ return wide_int_to_tree (type, ~poly_int_cst_value (arg0));
+ /* Perform BIT_NOT_EXPR on each element individually. */
+ else if (TREE_CODE (arg0) == VECTOR_CST)
+ {
diff -Nru gcc-11-11.5.0/debian/rules.patch gcc-11-11.5.0/debian/rules.patch
--- gcc-11-11.5.0/debian/rules.patch 2025-09-11 20:33:14.000000000 +1200
+++ gcc-11-11.5.0/debian/rules.patch 2025-12-18 15:22:44.000000000 +1300
@@ -78,6 +78,7 @@
libphobos-ppc64el \
gcc-hppa-build-fix \
libphobos-sparc64 \
+ pr118976 \
# with glibc (>= 2.31)
ifeq (,$(filter $(distrelease),wheezy jessie stretch buster precise xenial
bionic))
--- End Message ---
--- Begin Message ---
Source: gcc-11
Source-Version: 11.5.0-10
Done: Matthias Klose <[email protected]>
We believe that the bug you reported is fixed in the latest version of
gcc-11, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Matthias Klose <[email protected]> (supplier of updated gcc-11 package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Format: 1.8
Date: Tue, 03 Mar 2026 09:59:37 +0100
Source: gcc-11
Architecture: source
Version: 11.5.0-10
Distribution: unstable
Urgency: medium
Maintainer: Debian GCC Maintainers <[email protected]>
Changed-By: Matthias Klose <[email protected]>
Closes: 1123631
Changes:
gcc-11 (11.5.0-10) unstable; urgency=medium
.
* Fix PR tree-optimization/118976, taken from the gcc-12 branch.
Closes: #1123631.
Checksums-Sha1:
0cdea5b8da2e13fd76b253841fb8e60d5bc2deb5 21807 gcc-11_11.5.0-10.dsc
fcbea2ce31de844d22baaae3404f0b3a65735864 553452 gcc-11_11.5.0-10.debian.tar.xz
0cce0df7c8e71f44f8494529275a0872560808cf 9030 gcc-11_11.5.0-10_source.buildinfo
Checksums-Sha256:
7f77633f25de589a10160cc8b595f9f941d8ecbb726e7781dd73e506f4aa1dcd 21807
gcc-11_11.5.0-10.dsc
accd18df5521e03658e8176eb651ceb604e7c038e57d279729c2758f77db0094 553452
gcc-11_11.5.0-10.debian.tar.xz
ee824cf32f36558383b2d09b8ecb7451470834365c8a3739fccd51f2faddddc6 9030
gcc-11_11.5.0-10_source.buildinfo
Files:
dfae1a5102b21ff8b3738895b02b1224 21807 devel optional gcc-11_11.5.0-10.dsc
20047d1c4a60a0a2ecc8f969a8cb6a0f 553452 devel optional
gcc-11_11.5.0-10.debian.tar.xz
6b5985bfc2837c01922778e892a864f1 9030 devel optional
gcc-11_11.5.0-10_source.buildinfo
-----BEGIN PGP SIGNATURE-----
iQJEBAEBCgAuFiEE1WVxuIqLuvFAv2PWvX6qYHePpvUFAmmmo2AQHGRva29AZGVi
aWFuLm9yZwAKCRC9fqpgd4+m9SWMEACTBwqDQJoK/8H3Kfn90zpeHp/750i/US5X
q0lgARrxjk9TPzXjjb42E3YuhSbhtCpwjK5RQtG5Qu4xLYxhFGtjPNsPiZjwndnP
xlMPTdDk+DccBAJf3sw2cv0bt5ECbPI5cLxee8FMhAswsrHcqTUKEaqxRbDTah3f
rC5pysVvC9OPi/EDfKOkfAG64ctR2hwpgYKm9xPndstHkYltCdYpQ+uvDEN0OFhK
PiCQ+FIHIK7UVNwotUMo7FBwUCgF5XZi56qqL5hl+1nngoReHvoKAgmkpzjKC0zz
BTprXPtEpbqwNwvWK33fqDo3s9yEw7pI7D1TpupNC+amGcnBigPt+P9tp1Oz0vvd
eZ4WUVNH3d7RRFnHu9R1Br1JD1Noe0CpNiUV62Ea2aSYrHsZHxJpGy/lxNi503uW
fNtLkc8JuiFjTsJGH49EtGxSPDT18JNEXLR6UFW6fH8gzHaTxhNwaynDypu3MgB1
XmyWpNOzOtVXQg9Inf5J9wUA9Zd8BRhaRVp9JOqq3Sr0x6YqkbMSn4QyB3gLTUWR
Q4DXJ+2jCR6/CNxBxp3zqUGB8PebWD943AwFH6FMT3mB+MPMJNcrcAYNw52Bep6n
Pc7J9qiTU1DaSiokbEyYpsNkqSgad5CX8F/EVQ8FrH1B8O+GMPLj+xXFII7/2aEz
4QEyNhmMtQ==
=dvai
-----END PGP SIGNATURE-----
pgpDKeRt00pDu.pgp
Description: PGP signature
--- End Message ---