#1123631 gcc-11: GCC produces wrong code for arm64+sve

Package:
gcc-11
Source:
gcc-11
Description:
GNU C compiler
Submitter:
Vladimir Petko
Date:
2026-03-03 09:21:02 UTC
Severity:
normal
Tags:
#1123631#5
Date:
2025-12-19 01:06:12 UTC
From:
To:
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.

#1123631#10
Date:
2026-03-03 09:18:40 UTC
From:
To:
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 1123631@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Matthias Klose <doko@debian.org> (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 ftpmaster@ftp-master.debian.org)
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 <debian-gcc@lists.debian.org>
Changed-By: Matthias Klose <doko@debian.org>
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-----