From 32d14ec8c4bbcdf5db37c4142db79c7d97cc06b7 Mon Sep 17 00:00:00 2001
From: Alexey Min <alexey.min@gmail.com>
Date: Thu, 27 Feb 2020 06:22:14 +0300
Subject: [PATCH] cross/gcc-*: upgrade to 9.2.0-r6 (!999)

[ci:skip-build]
---
 cross/gcc-aarch64/0017-pr93402.patch | 45 ++++++++++++++++++++++++++++
 cross/gcc-aarch64/APKBUILD           |  4 ++-
 cross/gcc-armhf/0017-pr93402.patch   | 45 ++++++++++++++++++++++++++++
 cross/gcc-armhf/APKBUILD             |  4 ++-
 cross/gcc-armv7/0017-pr93402.patch   | 45 ++++++++++++++++++++++++++++
 cross/gcc-armv7/APKBUILD             |  4 ++-
 6 files changed, 144 insertions(+), 3 deletions(-)
 create mode 100644 cross/gcc-aarch64/0017-pr93402.patch
 create mode 100644 cross/gcc-armhf/0017-pr93402.patch
 create mode 100644 cross/gcc-armv7/0017-pr93402.patch

diff --git a/cross/gcc-aarch64/0017-pr93402.patch b/cross/gcc-aarch64/0017-pr93402.patch
new file mode 100644
index 000000000..c985fb682
--- /dev/null
+++ b/cross/gcc-aarch64/0017-pr93402.patch
@@ -0,0 +1,45 @@
+2020-01-23  Jakub Jelinek  <jakub@redhat.com>
+
+	PR rtl-optimization/93402
+	* postreload.c (reload_combine_recognize_pattern): Don't try to adjust
+	USE insns.
+
+	* gcc.c-torture/execute/pr93402.c: New test.
+
+--- a/gcc/postreload.c.jj	2020-01-12 11:54:36.000000000 +0100
++++ b/gcc/postreload.c	2020-01-23 17:23:25.359929516 +0100
+@@ -1078,6 +1078,10 @@ reload_combine_recognize_pattern (rtx_in
+       struct reg_use *use = reg_state[regno].reg_use + i;
+       if (GET_MODE (*use->usep) != mode)
+ 	return false;
++      /* Don't try to adjust (use (REGX)).  */
++      if (GET_CODE (PATTERN (use->insn)) == USE
++	  && &XEXP (PATTERN (use->insn), 0) == use->usep)
++	return false;
+     }
+ 
+   /* Look for (set (REGX) (CONST_INT))
+--- a/gcc/testsuite/gcc.c-torture/execute/pr93402.c.jj	2020-01-23 17:25:46.496803852 +0100
++++ b/gcc/testsuite/gcc.c-torture/execute/pr93402.c	2020-01-23 17:25:05.221425501 +0100
+@@ -0,0 +1,21 @@
++/* PR rtl-optimization/93402 */
++
++struct S { unsigned int a; unsigned long long b; };
++
++__attribute__((noipa)) struct S
++foo (unsigned long long x)
++{
++  struct S ret;
++  ret.a = 0;
++  ret.b = x * 11111111111ULL + 111111111111ULL;
++  return ret;
++}
++
++int
++main ()
++{
++  struct S a = foo (1);
++  if (a.a != 0 || a.b != 122222222222ULL)
++    __builtin_abort ();
++  return 0;
++}
diff --git a/cross/gcc-aarch64/APKBUILD b/cross/gcc-aarch64/APKBUILD
index aa75187c2..8b81d974e 100644
--- a/cross/gcc-aarch64/APKBUILD
+++ b/cross/gcc-aarch64/APKBUILD
@@ -30,7 +30,7 @@ pkgver=9.2.0
 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
 
 pkgname="gcc-aarch64"
-pkgrel=5
+pkgrel=6
 pkgdesc="Stage2 cross-compiler for aarch64"
 url="https://gcc.gnu.org"
 arch="x86_64"
@@ -207,6 +207,7 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
 	gcc-pure64-mips.patch
 	0016-invalid_tls_model.patch
 	gcc10-pr91920.patch
+	0017-pr93402.patch
 
 	400-dlang-phobos.patch
 	401-dlang-32bits.patch
@@ -655,6 +656,7 @@ f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45
 86be3338cc9c33089608bc4c5e3b7918c4e500a345c338f361b18c342119a6ed69af5495d72950de7106d760f003528b46ad14795e805f8a3331e206dcb234e3  gcc-pure64-mips.patch
 17e0faeef742d32d57a070d983480367dd28cd28d47a8966ce327afdff3a38ea76803a833c90aff7d3a93aa66dae76c9be47b2408500913b40571af25b85aca7  0016-invalid_tls_model.patch
 e9fef7677f9541848cd1df0bf3c330f06f1369bdf1d228238b7f1d03d8f2c4be07fd62be503b7bf72b6b1e2d4e404ddd957157b56b8050e3657820ade77491aa  gcc10-pr91920.patch
+0e20a5717c20ddc1d9f00276453b0abb4868adff0496604ad7d5b766a1028181c09c2061c5648bcfd4cb29dca7048cc866d2f27c013d82c2440164f17eac685d  0017-pr93402.patch
 38772c5b0905455a44c43d6ef7e5f140530006e2bde9f5ffd6b569c7cf9633992515f666b486d7a78c30ab8da99b92b2775c90fde47821ae542ef1c49dc405df  400-dlang-phobos.patch
 84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830  401-dlang-32bits.patch
 9d73f21eaa2458d28a144dd0e5478ed52763a4d8bbf62084b607db52bce1e2242f773c853fc34e6aae2d53c4124948139954627064e850e9dabaddaef5cb9d69  402-dlang-stat.patch
diff --git a/cross/gcc-armhf/0017-pr93402.patch b/cross/gcc-armhf/0017-pr93402.patch
new file mode 100644
index 000000000..c985fb682
--- /dev/null
+++ b/cross/gcc-armhf/0017-pr93402.patch
@@ -0,0 +1,45 @@
+2020-01-23  Jakub Jelinek  <jakub@redhat.com>
+
+	PR rtl-optimization/93402
+	* postreload.c (reload_combine_recognize_pattern): Don't try to adjust
+	USE insns.
+
+	* gcc.c-torture/execute/pr93402.c: New test.
+
+--- a/gcc/postreload.c.jj	2020-01-12 11:54:36.000000000 +0100
++++ b/gcc/postreload.c	2020-01-23 17:23:25.359929516 +0100
+@@ -1078,6 +1078,10 @@ reload_combine_recognize_pattern (rtx_in
+       struct reg_use *use = reg_state[regno].reg_use + i;
+       if (GET_MODE (*use->usep) != mode)
+ 	return false;
++      /* Don't try to adjust (use (REGX)).  */
++      if (GET_CODE (PATTERN (use->insn)) == USE
++	  && &XEXP (PATTERN (use->insn), 0) == use->usep)
++	return false;
+     }
+ 
+   /* Look for (set (REGX) (CONST_INT))
+--- a/gcc/testsuite/gcc.c-torture/execute/pr93402.c.jj	2020-01-23 17:25:46.496803852 +0100
++++ b/gcc/testsuite/gcc.c-torture/execute/pr93402.c	2020-01-23 17:25:05.221425501 +0100
+@@ -0,0 +1,21 @@
++/* PR rtl-optimization/93402 */
++
++struct S { unsigned int a; unsigned long long b; };
++
++__attribute__((noipa)) struct S
++foo (unsigned long long x)
++{
++  struct S ret;
++  ret.a = 0;
++  ret.b = x * 11111111111ULL + 111111111111ULL;
++  return ret;
++}
++
++int
++main ()
++{
++  struct S a = foo (1);
++  if (a.a != 0 || a.b != 122222222222ULL)
++    __builtin_abort ();
++  return 0;
++}
diff --git a/cross/gcc-armhf/APKBUILD b/cross/gcc-armhf/APKBUILD
index 5a1da60f1..914e389cb 100644
--- a/cross/gcc-armhf/APKBUILD
+++ b/cross/gcc-armhf/APKBUILD
@@ -30,7 +30,7 @@ pkgver=9.2.0
 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
 
 pkgname="gcc-armhf"
-pkgrel=5
+pkgrel=6
 pkgdesc="Stage2 cross-compiler for armhf"
 url="https://gcc.gnu.org"
 arch="x86_64"
@@ -207,6 +207,7 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
 	gcc-pure64-mips.patch
 	0016-invalid_tls_model.patch
 	gcc10-pr91920.patch
+	0017-pr93402.patch
 
 	400-dlang-phobos.patch
 	401-dlang-32bits.patch
@@ -655,6 +656,7 @@ f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45
 86be3338cc9c33089608bc4c5e3b7918c4e500a345c338f361b18c342119a6ed69af5495d72950de7106d760f003528b46ad14795e805f8a3331e206dcb234e3  gcc-pure64-mips.patch
 17e0faeef742d32d57a070d983480367dd28cd28d47a8966ce327afdff3a38ea76803a833c90aff7d3a93aa66dae76c9be47b2408500913b40571af25b85aca7  0016-invalid_tls_model.patch
 e9fef7677f9541848cd1df0bf3c330f06f1369bdf1d228238b7f1d03d8f2c4be07fd62be503b7bf72b6b1e2d4e404ddd957157b56b8050e3657820ade77491aa  gcc10-pr91920.patch
+0e20a5717c20ddc1d9f00276453b0abb4868adff0496604ad7d5b766a1028181c09c2061c5648bcfd4cb29dca7048cc866d2f27c013d82c2440164f17eac685d  0017-pr93402.patch
 38772c5b0905455a44c43d6ef7e5f140530006e2bde9f5ffd6b569c7cf9633992515f666b486d7a78c30ab8da99b92b2775c90fde47821ae542ef1c49dc405df  400-dlang-phobos.patch
 84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830  401-dlang-32bits.patch
 9d73f21eaa2458d28a144dd0e5478ed52763a4d8bbf62084b607db52bce1e2242f773c853fc34e6aae2d53c4124948139954627064e850e9dabaddaef5cb9d69  402-dlang-stat.patch
diff --git a/cross/gcc-armv7/0017-pr93402.patch b/cross/gcc-armv7/0017-pr93402.patch
new file mode 100644
index 000000000..c985fb682
--- /dev/null
+++ b/cross/gcc-armv7/0017-pr93402.patch
@@ -0,0 +1,45 @@
+2020-01-23  Jakub Jelinek  <jakub@redhat.com>
+
+	PR rtl-optimization/93402
+	* postreload.c (reload_combine_recognize_pattern): Don't try to adjust
+	USE insns.
+
+	* gcc.c-torture/execute/pr93402.c: New test.
+
+--- a/gcc/postreload.c.jj	2020-01-12 11:54:36.000000000 +0100
++++ b/gcc/postreload.c	2020-01-23 17:23:25.359929516 +0100
+@@ -1078,6 +1078,10 @@ reload_combine_recognize_pattern (rtx_in
+       struct reg_use *use = reg_state[regno].reg_use + i;
+       if (GET_MODE (*use->usep) != mode)
+ 	return false;
++      /* Don't try to adjust (use (REGX)).  */
++      if (GET_CODE (PATTERN (use->insn)) == USE
++	  && &XEXP (PATTERN (use->insn), 0) == use->usep)
++	return false;
+     }
+ 
+   /* Look for (set (REGX) (CONST_INT))
+--- a/gcc/testsuite/gcc.c-torture/execute/pr93402.c.jj	2020-01-23 17:25:46.496803852 +0100
++++ b/gcc/testsuite/gcc.c-torture/execute/pr93402.c	2020-01-23 17:25:05.221425501 +0100
+@@ -0,0 +1,21 @@
++/* PR rtl-optimization/93402 */
++
++struct S { unsigned int a; unsigned long long b; };
++
++__attribute__((noipa)) struct S
++foo (unsigned long long x)
++{
++  struct S ret;
++  ret.a = 0;
++  ret.b = x * 11111111111ULL + 111111111111ULL;
++  return ret;
++}
++
++int
++main ()
++{
++  struct S a = foo (1);
++  if (a.a != 0 || a.b != 122222222222ULL)
++    __builtin_abort ();
++  return 0;
++}
diff --git a/cross/gcc-armv7/APKBUILD b/cross/gcc-armv7/APKBUILD
index 72f828b3a..43f170105 100644
--- a/cross/gcc-armv7/APKBUILD
+++ b/cross/gcc-armv7/APKBUILD
@@ -30,7 +30,7 @@ pkgver=9.2.0
 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
 
 pkgname="gcc-armv7"
-pkgrel=5
+pkgrel=6
 pkgdesc="Stage2 cross-compiler for armv7"
 url="https://gcc.gnu.org"
 arch="x86_64"
@@ -207,6 +207,7 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
 	gcc-pure64-mips.patch
 	0016-invalid_tls_model.patch
 	gcc10-pr91920.patch
+	0017-pr93402.patch
 
 	400-dlang-phobos.patch
 	401-dlang-32bits.patch
@@ -655,6 +656,7 @@ f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45
 86be3338cc9c33089608bc4c5e3b7918c4e500a345c338f361b18c342119a6ed69af5495d72950de7106d760f003528b46ad14795e805f8a3331e206dcb234e3  gcc-pure64-mips.patch
 17e0faeef742d32d57a070d983480367dd28cd28d47a8966ce327afdff3a38ea76803a833c90aff7d3a93aa66dae76c9be47b2408500913b40571af25b85aca7  0016-invalid_tls_model.patch
 e9fef7677f9541848cd1df0bf3c330f06f1369bdf1d228238b7f1d03d8f2c4be07fd62be503b7bf72b6b1e2d4e404ddd957157b56b8050e3657820ade77491aa  gcc10-pr91920.patch
+0e20a5717c20ddc1d9f00276453b0abb4868adff0496604ad7d5b766a1028181c09c2061c5648bcfd4cb29dca7048cc866d2f27c013d82c2440164f17eac685d  0017-pr93402.patch
 38772c5b0905455a44c43d6ef7e5f140530006e2bde9f5ffd6b569c7cf9633992515f666b486d7a78c30ab8da99b92b2775c90fde47821ae542ef1c49dc405df  400-dlang-phobos.patch
 84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830  401-dlang-32bits.patch
 9d73f21eaa2458d28a144dd0e5478ed52763a4d8bbf62084b607db52bce1e2242f773c853fc34e6aae2d53c4124948139954627064e850e9dabaddaef5cb9d69  402-dlang-stat.patch