unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob aae5fc9f723712ccb9c561e3fa059150551d7429 1095 bytes (raw)
name: gnu/packages/patches/gcc-10-tree-sra-union-handling.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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))

debug log:

solving aae5fc9f72 ...
found aae5fc9f72 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).