[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
08/08: gnu: GCC: Fix union optimization issue.
From: |
guix-commits |
Subject: |
08/08: gnu: GCC: Fix union optimization issue. |
Date: |
Wed, 27 Jul 2022 12:24:01 -0400 (EDT) |
mbakke pushed a commit to branch core-updates
in repository guix.
commit 8a2b5f3f587459c11c037b9d372b4070263baae9
Author: Marius Bakke <marius@gnu.org>
AuthorDate: Mon Jul 25 03:23:31 2022 +0200
gnu: GCC: Fix union optimization issue.
* gnu/packages/patches/gcc-10-tree-sra-union-handling.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/gcc.scm (gcc-10, gcc-11)[source](patches): Add it.
* gnu/packages/rust.scm (rust-bootstrap)[native-inputs]: Remove GCC-9.
---
gnu/local.mk | 1 +
gnu/packages/gcc.scm | 6 ++--
.../patches/gcc-10-tree-sra-union-handling.patch | 33 ++++++++++++++++++++++
gnu/packages/rust.scm | 8 ------
4 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/gnu/local.mk b/gnu/local.mk
index f6dcfb95b4..407098e895 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1125,6 +1125,7 @@ dist_patch_DATA =
\
%D%/packages/patches/gcc-12-strmov-store-file-names.patch \
%D%/packages/patches/gcc-10-cross-environment-variables.patch \
%D%/packages/patches/gcc-12-cross-environment-variables.patch \
+ %D%/packages/patches/gcc-10-tree-sra-union-handling.patch \
%D%/packages/patches/gcolor3-update-libportal-usage.patch \
%D%/packages/patches/gd-fix-tests-on-i686.patch \
%D%/packages/patches/gd-brect-bounds.patch \
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 0d8a62cbe7..a957ae3480 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -665,7 +665,8 @@ It also includes runtime support libraries for these
languages.")
(base32
"1wg4xdizkksmwi66mvv2v4pk3ja8x64m7v9gzhykzd3wrmdpsaf9"))
(patches (search-patches "gcc-9-strmov-store-file-names.patch"
- "gcc-5.0-libvtv-runpath.patch"))
+ "gcc-5.0-libvtv-runpath.patch"
+ "gcc-10-tree-sra-union-handling.patch"))
(modules '((guix build utils)))
(snippet gcc-canadian-cross-objdump-snippet)))
(properties
@@ -686,7 +687,8 @@ It also includes runtime support libraries for these
languages.")
(base32
"0fdclcwf728wbq52vphfcjywzhpsjp3kifzj3pib3xcihs0z4z5l"))
(patches (search-patches "gcc-9-strmov-store-file-names.patch"
- "gcc-5.0-libvtv-runpath.patch"))
+ "gcc-5.0-libvtv-runpath.patch"
+ "gcc-10-tree-sra-union-handling.patch"))
(modules '((guix build utils)))
(snippet gcc-canadian-cross-objdump-snippet)))
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))
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 25472fefb0..759bf9a631 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -169,14 +169,6 @@
("zlib" ,zlib)))
(native-inputs
`(("bison" ,bison)
- ;; A compiler bug in gcc 10/11/12/13 prevents us from using gcc-10.4.
See:
- ;; https://github.com/thepowersgang/mrustc/issues/266
- ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105860
- ("gcc" ,gcc-9)
- ;; TODO: STARTFILE_PREFIX_SPEC is fixed on gcc<10 on core-updates.
- ,@(if (target-riscv64?)
- `(("gcc:lib" ,gcc-9 "lib"))
- '())
("flex" ,flex)
("pkg-config" ,pkg-config)
;; Required for the libstd sources.
- branch core-updates updated (f7815e76b0 -> 8a2b5f3f58), guix-commits, 2022/07/27
- 04/08: gnu: gdk-pixbuf: Propagate private dependencies., guix-commits, 2022/07/27
- 05/08: gnu: gdk-pixbuf: Use search path instead of patching docbook schema location., guix-commits, 2022/07/27
- 03/08: gnu: Remove harfbuzz@4., guix-commits, 2022/07/27
- 08/08: gnu: GCC: Fix union optimization issue.,
guix-commits <=
- 07/08: gnu: OpenLDAP: Update to 2.6.3., guix-commits, 2022/07/27
- 01/08: Merge branch 'staging' into core-updates, guix-commits, 2022/07/27
- 06/08: gnu: gdk-pixbuf: Remove input labels., guix-commits, 2022/07/27
- 02/08: gnu: harfbuzz: Update to 5.0.1., guix-commits, 2022/07/27