From 14e6594cc52e3c29cb75a41dc244733a041f209d Mon Sep 17 00:00:00 2001
From: Stefan Hansson <newbie13xd@gmail.com>
Date: Fri, 20 Oct 2023 13:06:28 +0200
Subject: [PATCH] cross/gcc-*: upgrade to 13.2.1_git20231014

---
 .../0035-Fix-ICE-observed-in-PR110280.patch   | 61 -------------------
 cross/gcc-aarch64/APKBUILD                    | 14 +++--
 .../0035-Fix-ICE-observed-in-PR110280.patch   | 61 -------------------
 cross/gcc-armhf/APKBUILD                      | 14 +++--
 .../0035-Fix-ICE-observed-in-PR110280.patch   | 61 -------------------
 cross/gcc-armv7/APKBUILD                      | 14 +++--
 .../0035-Fix-ICE-observed-in-PR110280.patch   | 61 -------------------
 cross/gcc-riscv64/APKBUILD                    | 14 +++--
 .../0035-Fix-ICE-observed-in-PR110280.patch   | 61 -------------------
 cross/gcc-x86/APKBUILD                        | 14 +++--
 10 files changed, 40 insertions(+), 335 deletions(-)
 delete mode 100644 cross/gcc-aarch64/0035-Fix-ICE-observed-in-PR110280.patch
 delete mode 100644 cross/gcc-armhf/0035-Fix-ICE-observed-in-PR110280.patch
 delete mode 100644 cross/gcc-armv7/0035-Fix-ICE-observed-in-PR110280.patch
 delete mode 100644 cross/gcc-riscv64/0035-Fix-ICE-observed-in-PR110280.patch
 delete mode 100644 cross/gcc-x86/0035-Fix-ICE-observed-in-PR110280.patch

diff --git a/cross/gcc-aarch64/0035-Fix-ICE-observed-in-PR110280.patch b/cross/gcc-aarch64/0035-Fix-ICE-observed-in-PR110280.patch
deleted file mode 100644
index b9a7eaf0f20..00000000000
--- a/cross/gcc-aarch64/0035-Fix-ICE-observed-in-PR110280.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From ef740fff300fd9eb8285fb5611f6205705ee54ec Mon Sep 17 00:00:00 2001
-From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
-Date: Fri, 23 Jun 2023 15:27:17 +0530
-Subject: [PATCH 35/35] Fix ICE observed in PR110280.
-
-gcc/ChangeLog:
-	PR tree-optimization/110280
-	* match.pd (vec_perm_expr(v, v, mask) -> v): Explicitly build vector
-	using build_vector_from_val with the element of input operand, and
-	mask's type if operand and mask's types don't match.
-
-gcc/testsuite/ChangeLog:
-	PR tree-optimization/110280
-	* gcc.target/aarch64/sve/pr110280.c: New test.
----
- gcc/match.pd                                    |  9 ++++++++-
- gcc/testsuite/gcc.target/aarch64/sve/pr110280.c | 12 ++++++++++++
- 2 files changed, 20 insertions(+), 1 deletion(-)
- create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-
-diff --git a/gcc/match.pd b/gcc/match.pd
-index 91182448250..c3bb4fbc0a7 100644
---- a/gcc/match.pd
-+++ b/gcc/match.pd
-@@ -8292,7 +8292,14 @@ and,
- 
- (simplify
-  (vec_perm vec_same_elem_p@0 @0 @1)
-- @0)
-+ (if (types_match (type, TREE_TYPE (@0)))
-+  @0
-+  (with
-+   {
-+     tree elem = uniform_vector_p (@0);
-+   }
-+   (if (elem)
-+    { build_vector_from_val (type, elem); }))))
- 
- /* Push VEC_PERM earlier if that may help FMA perception (PR101895).  */
- (simplify
-diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-new file mode 100644
-index 00000000000..d3279f38362
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-@@ -0,0 +1,12 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O3 -fdump-tree-optimized" } */
-+
-+#include "arm_sve.h"
-+
-+svuint32_t l()
-+{
-+  _Alignas(16) const unsigned int lanes[4] = {0, 0, 0, 0};
-+  return svld1rq_u32(svptrue_b8(), lanes);
-+}
-+
-+/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "optimized" } } */
--- 
-2.41.0
-
diff --git a/cross/gcc-aarch64/APKBUILD b/cross/gcc-aarch64/APKBUILD
index 6a52a3e5741..277d196a66f 100644
--- a/cross/gcc-aarch64/APKBUILD
+++ b/cross/gcc-aarch64/APKBUILD
@@ -24,8 +24,8 @@ CBUILDROOT="/"
 _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
 
 pkgname=gcc-aarch64
-pkgver=13.1.1_git20230722
-# i.e. 13.1.1, must match gcc/BASE-VER
+pkgver=13.2.1_git20231014
+# i.e. 13.2.1, must match gcc/BASE-VER
 _pkgbase="${pkgver%%_git*}"
 # date component from snapshots
 _pkgsnap="${pkgver##*_git}"
@@ -34,7 +34,7 @@ _pkgsnap="${pkgver##*_git}"
 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
 
 pkgname=gcc-aarch64
-pkgrel=3
+pkgrel=0
 pkgdesc="Stage2 cross-compiler for aarch64"
 url="https://gcc.gnu.org"
 arch="x86_64"
@@ -268,10 +268,13 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${
 	0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
 	0033-libphobos-do-not-use-LFS64-symbols.patch
 	0034-libgo-fix-lfs64-use.patch
-	0035-Fix-ICE-observed-in-PR110280.patch
 	0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch
 	"
 
+# secfixes:
+#   13.2.1_git20231014-r0:
+#     - CVE-2023-4039
+
 # we build out-of-tree
 _gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap
 _gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}"
@@ -784,7 +787,7 @@ gdb() {
 }
 
 sha512sums="
-284719308cad4546ebd85934fb9f12112e8f1a4c3e5beea0760da1f73509907c194e7c133e6e755b6148bd1c51a72c071ac0d16b05641d901af7105461686655  gcc-13-20230722.tar.xz
+406673a62deba759fc0532a801b3f57cabf894ea328587b23e62a707ba5767b0e3ae9b3f86bf3c6fcf13e8a3c30bc470e6598b625c8231efb629034211c162c2  gcc-13-20231014.tar.xz
 1ecffba1b07d60e1b4422302b032bbea918b674c8e12b30aa6965b544d700ce86b61e9f7b8d402c6caf59257f491a394dd0912f0948565d6eae9335ee54f3b35  0001-posix_memalign.patch
 163f282455b6a4df33f011bcd8b0440566ba0ffaeeab30d8ac52d39948980a56881ca0eff60687129d59556389a58b9d64e7768750bd70b1fe0fedbc9fc30dc2  0002-gcc-poison-system-directories.patch
 3f24bb6a50d3c45b71ea05590e32fe3e69b91377ab185352891d5035c76ed193117c6d0b314a4c364bcf136b9a9dd5c926d6c7c30ab436976c121ebfea8d3ddd  0003-specs-turn-on-Wl-z-now-by-default.patch
@@ -819,6 +822,5 @@ d47b559075f40d526235f47b91da1d0cf6bfe6c5b7311bbfe08af9dd6e8f27e6c7cd82e3b2d529aa
 b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95e21c9ffbf2412193f8b9fc89a4c36fa5a6a041661ac7399d  0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
 c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75  0033-libphobos-do-not-use-LFS64-symbols.patch
 c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c  0034-libgo-fix-lfs64-use.patch
-048d767f4477c92ee6835850d13063ede21c0be751d0945c94445d04054e134cdc617eeb0b1ac8c892a604d8644580fcfebeccaf537d6b7380558ac6378e445a  0035-Fix-ICE-observed-in-PR110280.patch
 cc1e10ac6e72db816f09325e301103109cc212a6f3de3ce0b9b038d149233c467319d203941695dbf3d7b9e2dcbbcd17609cdb056e831fcc323cd592423882d8  0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch
 "
diff --git a/cross/gcc-armhf/0035-Fix-ICE-observed-in-PR110280.patch b/cross/gcc-armhf/0035-Fix-ICE-observed-in-PR110280.patch
deleted file mode 100644
index b9a7eaf0f20..00000000000
--- a/cross/gcc-armhf/0035-Fix-ICE-observed-in-PR110280.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From ef740fff300fd9eb8285fb5611f6205705ee54ec Mon Sep 17 00:00:00 2001
-From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
-Date: Fri, 23 Jun 2023 15:27:17 +0530
-Subject: [PATCH 35/35] Fix ICE observed in PR110280.
-
-gcc/ChangeLog:
-	PR tree-optimization/110280
-	* match.pd (vec_perm_expr(v, v, mask) -> v): Explicitly build vector
-	using build_vector_from_val with the element of input operand, and
-	mask's type if operand and mask's types don't match.
-
-gcc/testsuite/ChangeLog:
-	PR tree-optimization/110280
-	* gcc.target/aarch64/sve/pr110280.c: New test.
----
- gcc/match.pd                                    |  9 ++++++++-
- gcc/testsuite/gcc.target/aarch64/sve/pr110280.c | 12 ++++++++++++
- 2 files changed, 20 insertions(+), 1 deletion(-)
- create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-
-diff --git a/gcc/match.pd b/gcc/match.pd
-index 91182448250..c3bb4fbc0a7 100644
---- a/gcc/match.pd
-+++ b/gcc/match.pd
-@@ -8292,7 +8292,14 @@ and,
- 
- (simplify
-  (vec_perm vec_same_elem_p@0 @0 @1)
-- @0)
-+ (if (types_match (type, TREE_TYPE (@0)))
-+  @0
-+  (with
-+   {
-+     tree elem = uniform_vector_p (@0);
-+   }
-+   (if (elem)
-+    { build_vector_from_val (type, elem); }))))
- 
- /* Push VEC_PERM earlier if that may help FMA perception (PR101895).  */
- (simplify
-diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-new file mode 100644
-index 00000000000..d3279f38362
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-@@ -0,0 +1,12 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O3 -fdump-tree-optimized" } */
-+
-+#include "arm_sve.h"
-+
-+svuint32_t l()
-+{
-+  _Alignas(16) const unsigned int lanes[4] = {0, 0, 0, 0};
-+  return svld1rq_u32(svptrue_b8(), lanes);
-+}
-+
-+/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "optimized" } } */
--- 
-2.41.0
-
diff --git a/cross/gcc-armhf/APKBUILD b/cross/gcc-armhf/APKBUILD
index be637d1b0d3..d4c7d3998d4 100644
--- a/cross/gcc-armhf/APKBUILD
+++ b/cross/gcc-armhf/APKBUILD
@@ -24,8 +24,8 @@ CBUILDROOT="/"
 _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
 
 pkgname=gcc-armhf
-pkgver=13.1.1_git20230722
-# i.e. 13.1.1, must match gcc/BASE-VER
+pkgver=13.2.1_git20231014
+# i.e. 13.2.1, must match gcc/BASE-VER
 _pkgbase="${pkgver%%_git*}"
 # date component from snapshots
 _pkgsnap="${pkgver##*_git}"
@@ -34,7 +34,7 @@ _pkgsnap="${pkgver##*_git}"
 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
 
 pkgname=gcc-armhf
-pkgrel=3
+pkgrel=0
 pkgdesc="Stage2 cross-compiler for armhf"
 url="https://gcc.gnu.org"
 arch="x86_64"
@@ -268,10 +268,13 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${
 	0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
 	0033-libphobos-do-not-use-LFS64-symbols.patch
 	0034-libgo-fix-lfs64-use.patch
-	0035-Fix-ICE-observed-in-PR110280.patch
 	0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch
 	"
 
+# secfixes:
+#   13.2.1_git20231014-r0:
+#     - CVE-2023-4039
+
 # we build out-of-tree
 _gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap
 _gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}"
@@ -784,7 +787,7 @@ gdb() {
 }
 
 sha512sums="
-284719308cad4546ebd85934fb9f12112e8f1a4c3e5beea0760da1f73509907c194e7c133e6e755b6148bd1c51a72c071ac0d16b05641d901af7105461686655  gcc-13-20230722.tar.xz
+406673a62deba759fc0532a801b3f57cabf894ea328587b23e62a707ba5767b0e3ae9b3f86bf3c6fcf13e8a3c30bc470e6598b625c8231efb629034211c162c2  gcc-13-20231014.tar.xz
 1ecffba1b07d60e1b4422302b032bbea918b674c8e12b30aa6965b544d700ce86b61e9f7b8d402c6caf59257f491a394dd0912f0948565d6eae9335ee54f3b35  0001-posix_memalign.patch
 163f282455b6a4df33f011bcd8b0440566ba0ffaeeab30d8ac52d39948980a56881ca0eff60687129d59556389a58b9d64e7768750bd70b1fe0fedbc9fc30dc2  0002-gcc-poison-system-directories.patch
 3f24bb6a50d3c45b71ea05590e32fe3e69b91377ab185352891d5035c76ed193117c6d0b314a4c364bcf136b9a9dd5c926d6c7c30ab436976c121ebfea8d3ddd  0003-specs-turn-on-Wl-z-now-by-default.patch
@@ -819,6 +822,5 @@ d47b559075f40d526235f47b91da1d0cf6bfe6c5b7311bbfe08af9dd6e8f27e6c7cd82e3b2d529aa
 b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95e21c9ffbf2412193f8b9fc89a4c36fa5a6a041661ac7399d  0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
 c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75  0033-libphobos-do-not-use-LFS64-symbols.patch
 c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c  0034-libgo-fix-lfs64-use.patch
-048d767f4477c92ee6835850d13063ede21c0be751d0945c94445d04054e134cdc617eeb0b1ac8c892a604d8644580fcfebeccaf537d6b7380558ac6378e445a  0035-Fix-ICE-observed-in-PR110280.patch
 cc1e10ac6e72db816f09325e301103109cc212a6f3de3ce0b9b038d149233c467319d203941695dbf3d7b9e2dcbbcd17609cdb056e831fcc323cd592423882d8  0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch
 "
diff --git a/cross/gcc-armv7/0035-Fix-ICE-observed-in-PR110280.patch b/cross/gcc-armv7/0035-Fix-ICE-observed-in-PR110280.patch
deleted file mode 100644
index b9a7eaf0f20..00000000000
--- a/cross/gcc-armv7/0035-Fix-ICE-observed-in-PR110280.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From ef740fff300fd9eb8285fb5611f6205705ee54ec Mon Sep 17 00:00:00 2001
-From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
-Date: Fri, 23 Jun 2023 15:27:17 +0530
-Subject: [PATCH 35/35] Fix ICE observed in PR110280.
-
-gcc/ChangeLog:
-	PR tree-optimization/110280
-	* match.pd (vec_perm_expr(v, v, mask) -> v): Explicitly build vector
-	using build_vector_from_val with the element of input operand, and
-	mask's type if operand and mask's types don't match.
-
-gcc/testsuite/ChangeLog:
-	PR tree-optimization/110280
-	* gcc.target/aarch64/sve/pr110280.c: New test.
----
- gcc/match.pd                                    |  9 ++++++++-
- gcc/testsuite/gcc.target/aarch64/sve/pr110280.c | 12 ++++++++++++
- 2 files changed, 20 insertions(+), 1 deletion(-)
- create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-
-diff --git a/gcc/match.pd b/gcc/match.pd
-index 91182448250..c3bb4fbc0a7 100644
---- a/gcc/match.pd
-+++ b/gcc/match.pd
-@@ -8292,7 +8292,14 @@ and,
- 
- (simplify
-  (vec_perm vec_same_elem_p@0 @0 @1)
-- @0)
-+ (if (types_match (type, TREE_TYPE (@0)))
-+  @0
-+  (with
-+   {
-+     tree elem = uniform_vector_p (@0);
-+   }
-+   (if (elem)
-+    { build_vector_from_val (type, elem); }))))
- 
- /* Push VEC_PERM earlier if that may help FMA perception (PR101895).  */
- (simplify
-diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-new file mode 100644
-index 00000000000..d3279f38362
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-@@ -0,0 +1,12 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O3 -fdump-tree-optimized" } */
-+
-+#include "arm_sve.h"
-+
-+svuint32_t l()
-+{
-+  _Alignas(16) const unsigned int lanes[4] = {0, 0, 0, 0};
-+  return svld1rq_u32(svptrue_b8(), lanes);
-+}
-+
-+/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "optimized" } } */
--- 
-2.41.0
-
diff --git a/cross/gcc-armv7/APKBUILD b/cross/gcc-armv7/APKBUILD
index 63211ad8e63..545cb8a29bd 100644
--- a/cross/gcc-armv7/APKBUILD
+++ b/cross/gcc-armv7/APKBUILD
@@ -24,8 +24,8 @@ CBUILDROOT="/"
 _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
 
 pkgname=gcc-armv7
-pkgver=13.1.1_git20230722
-# i.e. 13.1.1, must match gcc/BASE-VER
+pkgver=13.2.1_git20231014
+# i.e. 13.2.1, must match gcc/BASE-VER
 _pkgbase="${pkgver%%_git*}"
 # date component from snapshots
 _pkgsnap="${pkgver##*_git}"
@@ -34,7 +34,7 @@ _pkgsnap="${pkgver##*_git}"
 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
 
 pkgname=gcc-armv7
-pkgrel=3
+pkgrel=0
 pkgdesc="Stage2 cross-compiler for armv7"
 url="https://gcc.gnu.org"
 arch="x86_64"
@@ -268,10 +268,13 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${
 	0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
 	0033-libphobos-do-not-use-LFS64-symbols.patch
 	0034-libgo-fix-lfs64-use.patch
-	0035-Fix-ICE-observed-in-PR110280.patch
 	0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch
 	"
 
+# secfixes:
+#   13.2.1_git20231014-r0:
+#     - CVE-2023-4039
+
 # we build out-of-tree
 _gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap
 _gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}"
@@ -784,7 +787,7 @@ gdb() {
 }
 
 sha512sums="
-284719308cad4546ebd85934fb9f12112e8f1a4c3e5beea0760da1f73509907c194e7c133e6e755b6148bd1c51a72c071ac0d16b05641d901af7105461686655  gcc-13-20230722.tar.xz
+406673a62deba759fc0532a801b3f57cabf894ea328587b23e62a707ba5767b0e3ae9b3f86bf3c6fcf13e8a3c30bc470e6598b625c8231efb629034211c162c2  gcc-13-20231014.tar.xz
 1ecffba1b07d60e1b4422302b032bbea918b674c8e12b30aa6965b544d700ce86b61e9f7b8d402c6caf59257f491a394dd0912f0948565d6eae9335ee54f3b35  0001-posix_memalign.patch
 163f282455b6a4df33f011bcd8b0440566ba0ffaeeab30d8ac52d39948980a56881ca0eff60687129d59556389a58b9d64e7768750bd70b1fe0fedbc9fc30dc2  0002-gcc-poison-system-directories.patch
 3f24bb6a50d3c45b71ea05590e32fe3e69b91377ab185352891d5035c76ed193117c6d0b314a4c364bcf136b9a9dd5c926d6c7c30ab436976c121ebfea8d3ddd  0003-specs-turn-on-Wl-z-now-by-default.patch
@@ -819,6 +822,5 @@ d47b559075f40d526235f47b91da1d0cf6bfe6c5b7311bbfe08af9dd6e8f27e6c7cd82e3b2d529aa
 b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95e21c9ffbf2412193f8b9fc89a4c36fa5a6a041661ac7399d  0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
 c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75  0033-libphobos-do-not-use-LFS64-symbols.patch
 c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c  0034-libgo-fix-lfs64-use.patch
-048d767f4477c92ee6835850d13063ede21c0be751d0945c94445d04054e134cdc617eeb0b1ac8c892a604d8644580fcfebeccaf537d6b7380558ac6378e445a  0035-Fix-ICE-observed-in-PR110280.patch
 cc1e10ac6e72db816f09325e301103109cc212a6f3de3ce0b9b038d149233c467319d203941695dbf3d7b9e2dcbbcd17609cdb056e831fcc323cd592423882d8  0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch
 "
diff --git a/cross/gcc-riscv64/0035-Fix-ICE-observed-in-PR110280.patch b/cross/gcc-riscv64/0035-Fix-ICE-observed-in-PR110280.patch
deleted file mode 100644
index b9a7eaf0f20..00000000000
--- a/cross/gcc-riscv64/0035-Fix-ICE-observed-in-PR110280.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From ef740fff300fd9eb8285fb5611f6205705ee54ec Mon Sep 17 00:00:00 2001
-From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
-Date: Fri, 23 Jun 2023 15:27:17 +0530
-Subject: [PATCH 35/35] Fix ICE observed in PR110280.
-
-gcc/ChangeLog:
-	PR tree-optimization/110280
-	* match.pd (vec_perm_expr(v, v, mask) -> v): Explicitly build vector
-	using build_vector_from_val with the element of input operand, and
-	mask's type if operand and mask's types don't match.
-
-gcc/testsuite/ChangeLog:
-	PR tree-optimization/110280
-	* gcc.target/aarch64/sve/pr110280.c: New test.
----
- gcc/match.pd                                    |  9 ++++++++-
- gcc/testsuite/gcc.target/aarch64/sve/pr110280.c | 12 ++++++++++++
- 2 files changed, 20 insertions(+), 1 deletion(-)
- create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-
-diff --git a/gcc/match.pd b/gcc/match.pd
-index 91182448250..c3bb4fbc0a7 100644
---- a/gcc/match.pd
-+++ b/gcc/match.pd
-@@ -8292,7 +8292,14 @@ and,
- 
- (simplify
-  (vec_perm vec_same_elem_p@0 @0 @1)
-- @0)
-+ (if (types_match (type, TREE_TYPE (@0)))
-+  @0
-+  (with
-+   {
-+     tree elem = uniform_vector_p (@0);
-+   }
-+   (if (elem)
-+    { build_vector_from_val (type, elem); }))))
- 
- /* Push VEC_PERM earlier if that may help FMA perception (PR101895).  */
- (simplify
-diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-new file mode 100644
-index 00000000000..d3279f38362
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-@@ -0,0 +1,12 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O3 -fdump-tree-optimized" } */
-+
-+#include "arm_sve.h"
-+
-+svuint32_t l()
-+{
-+  _Alignas(16) const unsigned int lanes[4] = {0, 0, 0, 0};
-+  return svld1rq_u32(svptrue_b8(), lanes);
-+}
-+
-+/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "optimized" } } */
--- 
-2.41.0
-
diff --git a/cross/gcc-riscv64/APKBUILD b/cross/gcc-riscv64/APKBUILD
index 7566b168d60..6d1e1f4307f 100644
--- a/cross/gcc-riscv64/APKBUILD
+++ b/cross/gcc-riscv64/APKBUILD
@@ -24,8 +24,8 @@ CBUILDROOT="/"
 _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
 
 pkgname=gcc-riscv64
-pkgver=13.1.1_git20230722
-# i.e. 13.1.1, must match gcc/BASE-VER
+pkgver=13.2.1_git20231014
+# i.e. 13.2.1, must match gcc/BASE-VER
 _pkgbase="${pkgver%%_git*}"
 # date component from snapshots
 _pkgsnap="${pkgver##*_git}"
@@ -34,7 +34,7 @@ _pkgsnap="${pkgver##*_git}"
 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
 
 pkgname=gcc-riscv64
-pkgrel=3
+pkgrel=0
 pkgdesc="Stage2 cross-compiler for riscv64"
 url="https://gcc.gnu.org"
 arch="x86_64"
@@ -268,10 +268,13 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${
 	0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
 	0033-libphobos-do-not-use-LFS64-symbols.patch
 	0034-libgo-fix-lfs64-use.patch
-	0035-Fix-ICE-observed-in-PR110280.patch
 	0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch
 	"
 
+# secfixes:
+#   13.2.1_git20231014-r0:
+#     - CVE-2023-4039
+
 # we build out-of-tree
 _gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap
 _gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}"
@@ -784,7 +787,7 @@ gdb() {
 }
 
 sha512sums="
-284719308cad4546ebd85934fb9f12112e8f1a4c3e5beea0760da1f73509907c194e7c133e6e755b6148bd1c51a72c071ac0d16b05641d901af7105461686655  gcc-13-20230722.tar.xz
+406673a62deba759fc0532a801b3f57cabf894ea328587b23e62a707ba5767b0e3ae9b3f86bf3c6fcf13e8a3c30bc470e6598b625c8231efb629034211c162c2  gcc-13-20231014.tar.xz
 1ecffba1b07d60e1b4422302b032bbea918b674c8e12b30aa6965b544d700ce86b61e9f7b8d402c6caf59257f491a394dd0912f0948565d6eae9335ee54f3b35  0001-posix_memalign.patch
 163f282455b6a4df33f011bcd8b0440566ba0ffaeeab30d8ac52d39948980a56881ca0eff60687129d59556389a58b9d64e7768750bd70b1fe0fedbc9fc30dc2  0002-gcc-poison-system-directories.patch
 3f24bb6a50d3c45b71ea05590e32fe3e69b91377ab185352891d5035c76ed193117c6d0b314a4c364bcf136b9a9dd5c926d6c7c30ab436976c121ebfea8d3ddd  0003-specs-turn-on-Wl-z-now-by-default.patch
@@ -819,6 +822,5 @@ d47b559075f40d526235f47b91da1d0cf6bfe6c5b7311bbfe08af9dd6e8f27e6c7cd82e3b2d529aa
 b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95e21c9ffbf2412193f8b9fc89a4c36fa5a6a041661ac7399d  0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
 c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75  0033-libphobos-do-not-use-LFS64-symbols.patch
 c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c  0034-libgo-fix-lfs64-use.patch
-048d767f4477c92ee6835850d13063ede21c0be751d0945c94445d04054e134cdc617eeb0b1ac8c892a604d8644580fcfebeccaf537d6b7380558ac6378e445a  0035-Fix-ICE-observed-in-PR110280.patch
 cc1e10ac6e72db816f09325e301103109cc212a6f3de3ce0b9b038d149233c467319d203941695dbf3d7b9e2dcbbcd17609cdb056e831fcc323cd592423882d8  0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch
 "
diff --git a/cross/gcc-x86/0035-Fix-ICE-observed-in-PR110280.patch b/cross/gcc-x86/0035-Fix-ICE-observed-in-PR110280.patch
deleted file mode 100644
index b9a7eaf0f20..00000000000
--- a/cross/gcc-x86/0035-Fix-ICE-observed-in-PR110280.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From ef740fff300fd9eb8285fb5611f6205705ee54ec Mon Sep 17 00:00:00 2001
-From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
-Date: Fri, 23 Jun 2023 15:27:17 +0530
-Subject: [PATCH 35/35] Fix ICE observed in PR110280.
-
-gcc/ChangeLog:
-	PR tree-optimization/110280
-	* match.pd (vec_perm_expr(v, v, mask) -> v): Explicitly build vector
-	using build_vector_from_val with the element of input operand, and
-	mask's type if operand and mask's types don't match.
-
-gcc/testsuite/ChangeLog:
-	PR tree-optimization/110280
-	* gcc.target/aarch64/sve/pr110280.c: New test.
----
- gcc/match.pd                                    |  9 ++++++++-
- gcc/testsuite/gcc.target/aarch64/sve/pr110280.c | 12 ++++++++++++
- 2 files changed, 20 insertions(+), 1 deletion(-)
- create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-
-diff --git a/gcc/match.pd b/gcc/match.pd
-index 91182448250..c3bb4fbc0a7 100644
---- a/gcc/match.pd
-+++ b/gcc/match.pd
-@@ -8292,7 +8292,14 @@ and,
- 
- (simplify
-  (vec_perm vec_same_elem_p@0 @0 @1)
-- @0)
-+ (if (types_match (type, TREE_TYPE (@0)))
-+  @0
-+  (with
-+   {
-+     tree elem = uniform_vector_p (@0);
-+   }
-+   (if (elem)
-+    { build_vector_from_val (type, elem); }))))
- 
- /* Push VEC_PERM earlier if that may help FMA perception (PR101895).  */
- (simplify
-diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-new file mode 100644
-index 00000000000..d3279f38362
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
-@@ -0,0 +1,12 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O3 -fdump-tree-optimized" } */
-+
-+#include "arm_sve.h"
-+
-+svuint32_t l()
-+{
-+  _Alignas(16) const unsigned int lanes[4] = {0, 0, 0, 0};
-+  return svld1rq_u32(svptrue_b8(), lanes);
-+}
-+
-+/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "optimized" } } */
--- 
-2.41.0
-
diff --git a/cross/gcc-x86/APKBUILD b/cross/gcc-x86/APKBUILD
index 157ba0ba436..c505e04a0bb 100644
--- a/cross/gcc-x86/APKBUILD
+++ b/cross/gcc-x86/APKBUILD
@@ -24,8 +24,8 @@ CBUILDROOT="/"
 _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
 
 pkgname=gcc-x86
-pkgver=13.1.1_git20230722
-# i.e. 13.1.1, must match gcc/BASE-VER
+pkgver=13.2.1_git20231014
+# i.e. 13.2.1, must match gcc/BASE-VER
 _pkgbase="${pkgver%%_git*}"
 # date component from snapshots
 _pkgsnap="${pkgver##*_git}"
@@ -34,7 +34,7 @@ _pkgsnap="${pkgver##*_git}"
 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
 
 pkgname=gcc-x86
-pkgrel=3
+pkgrel=0
 pkgdesc="Stage2 cross-compiler for x86"
 url="https://gcc.gnu.org"
 arch="x86_64"
@@ -268,10 +268,13 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${
 	0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
 	0033-libphobos-do-not-use-LFS64-symbols.patch
 	0034-libgo-fix-lfs64-use.patch
-	0035-Fix-ICE-observed-in-PR110280.patch
 	0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch
 	"
 
+# secfixes:
+#   13.2.1_git20231014-r0:
+#     - CVE-2023-4039
+
 # we build out-of-tree
 _gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap
 _gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}"
@@ -784,7 +787,7 @@ gdb() {
 }
 
 sha512sums="
-284719308cad4546ebd85934fb9f12112e8f1a4c3e5beea0760da1f73509907c194e7c133e6e755b6148bd1c51a72c071ac0d16b05641d901af7105461686655  gcc-13-20230722.tar.xz
+406673a62deba759fc0532a801b3f57cabf894ea328587b23e62a707ba5767b0e3ae9b3f86bf3c6fcf13e8a3c30bc470e6598b625c8231efb629034211c162c2  gcc-13-20231014.tar.xz
 1ecffba1b07d60e1b4422302b032bbea918b674c8e12b30aa6965b544d700ce86b61e9f7b8d402c6caf59257f491a394dd0912f0948565d6eae9335ee54f3b35  0001-posix_memalign.patch
 163f282455b6a4df33f011bcd8b0440566ba0ffaeeab30d8ac52d39948980a56881ca0eff60687129d59556389a58b9d64e7768750bd70b1fe0fedbc9fc30dc2  0002-gcc-poison-system-directories.patch
 3f24bb6a50d3c45b71ea05590e32fe3e69b91377ab185352891d5035c76ed193117c6d0b314a4c364bcf136b9a9dd5c926d6c7c30ab436976c121ebfea8d3ddd  0003-specs-turn-on-Wl-z-now-by-default.patch
@@ -819,6 +822,5 @@ d47b559075f40d526235f47b91da1d0cf6bfe6c5b7311bbfe08af9dd6e8f27e6c7cd82e3b2d529aa
 b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95e21c9ffbf2412193f8b9fc89a4c36fa5a6a041661ac7399d  0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
 c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75  0033-libphobos-do-not-use-LFS64-symbols.patch
 c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c  0034-libgo-fix-lfs64-use.patch
-048d767f4477c92ee6835850d13063ede21c0be751d0945c94445d04054e134cdc617eeb0b1ac8c892a604d8644580fcfebeccaf537d6b7380558ac6378e445a  0035-Fix-ICE-observed-in-PR110280.patch
 cc1e10ac6e72db816f09325e301103109cc212a6f3de3ce0b9b038d149233c467319d203941695dbf3d7b9e2dcbbcd17609cdb056e831fcc323cd592423882d8  0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch
 "
-- 
GitLab