diff mbox series

[bug#67686,core-updates,1/5] gnu: gcc@11: Update to 11.4.0.

Message ID 8734wd93hx.fsf@gnu.org
State New
Headers show
Series [bug#67686,core-updates,1/5] gnu: gcc@11: Update to 11.4.0. | expand

Commit Message

Janneke Nieuwenhuizen Dec. 7, 2023, 8:11 p.m. UTC
Ludovic Courtès writes:

> From: Greg Hogan <code@greghogan.com>
>
> * gnu/packages/gcc.scm (gcc-11): Update to 11.4.0.
> Remove ‘gcc-10-tree-sra-union-handling.patch’.
> * gnu/local.mk: Delist patch.
> * gnu/packages/patches/gcc-10-tree-sra-union-handling.patch: Delete.

[On core-updates] this patch is still used, I recommend the attatched
squash commit.

Comments

Ludovic Courtès Dec. 7, 2023, 9:13 p.m. UTC | #1
Janneke Nieuwenhuizen <janneke@gnu.org> skribis:

>>From aa0896545b283adc2c7451bbccca2b391a5affb8 Mon Sep 17 00:00:00 2001
> Message-ID: <aa0896545b283adc2c7451bbccca2b391a5affb8.1701979835.git.janneke@gnu.org>
> From: Janneke Nieuwenhuizen <janneke@gnu.org>
> Date: Thu, 7 Dec 2023 21:04:31 +0100
> Subject: [PATCH] squash! gnu: gcc@11: Update to 11.4.0.
>
> Do not remove and delist this patch, it's still used by gcc-10.
>
> * gnu/packages/patches/gcc-10-tree-sra-union-handling.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.
>
> Change-Id: Iff8c9151326c87cb13db9c5b1a00c44b8eef95e3

Good catch, added!

Ludo’.
diff mbox series

Patch

From aa0896545b283adc2c7451bbccca2b391a5affb8 Mon Sep 17 00:00:00 2001
Message-ID: <aa0896545b283adc2c7451bbccca2b391a5affb8.1701979835.git.janneke@gnu.org>
From: Janneke Nieuwenhuizen <janneke@gnu.org>
Date: Thu, 7 Dec 2023 21:04:31 +0100
Subject: [PATCH] squash! gnu: gcc@11: Update to 11.4.0.

Do not remove and delist this patch, it's still used by gcc-10.

* gnu/packages/patches/gcc-10-tree-sra-union-handling.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.

Change-Id: Iff8c9151326c87cb13db9c5b1a00c44b8eef95e3
---
 gnu/local.mk                                  |  1 +
 .../gcc-10-tree-sra-union-handling.patch      | 33 +++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 gnu/packages/patches/gcc-10-tree-sra-union-handling.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 7ecc828003..231488a1be 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1250,6 +1250,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/gcc-10-cross-environment-variables.patch \
   %D%/packages/patches/gcc-11-libstdc++-hurd-libpthread.patch   \
   %D%/packages/patches/gcc-12-cross-environment-variables.patch \
+  %D%/packages/patches/gcc-10-tree-sra-union-handling.patch	\
   %D%/packages/patches/gcc-11-libstdc++-powerpc.patch           \
   %D%/packages/patches/gcc-13.2.0-libstdc++-docbook-xsl-uri.patch	\
   %D%/packages/patches/gcc-13.2.0-libstdc++-info-install-fix.patch	\
diff --git a/gnu/packages/patches/gcc-10-tree-sra-union-handling.patch b/gnu/packages/patches/gcc-10-tree-sra-union-handling.patch
new file mode 100644
index 0000000000..aae5fc9f72
--- /dev/null
+++ b/gnu/packages/patches/gcc-10-tree-sra-union-handling.patch
@@ -0,0 +1,33 @@ 
+Fix a regression in GCC 10/11/12 where some union structures
+could get miscompiled when optimizations are enabled:
+
+  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105860
+
+Taken from upstream:
+
+  https://gcc.gnu.org/g:16afe2e2862f3dd93c711d7f8d436dee23c6c34d
+
+diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
+index 09d951a261b..420329f63f6 100644
+--- a/gcc/tree-sra.c
++++ b/gcc/tree-sra.c
+@@ -1647,7 +1647,18 @@ build_ref_for_offset (location_t loc, tree base, poly_int64 offset,
+ static tree
+ build_reconstructed_reference (location_t, tree base, struct access *model)
+ {
+-  tree expr = model->expr, prev_expr = NULL;
++  tree expr = model->expr;
++  /* We have to make sure to start just below the outermost union.  */
++  tree start_expr = expr;
++  while (handled_component_p (expr))
++    {
++      if (TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == UNION_TYPE)
++	start_expr = expr;
++      expr = TREE_OPERAND (expr, 0);
++    }
++
++  expr = start_expr;
++  tree prev_expr = NULL_TREE;
+   while (!types_compatible_p (TREE_TYPE (expr), TREE_TYPE (base)))
+     {
+       if (!handled_component_p (expr))

base-commit: 941456404cc52da9492836150cbcfa44f6a476e7
-- 
2.41.0