]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/40351 (ice in generate_subtree_copies for Linux kernel build)
authorMartin Jambor <mjambor@suse.cz>
Tue, 9 Jun 2009 16:52:57 +0000 (18:52 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Tue, 9 Jun 2009 16:52:57 +0000 (18:52 +0200)
2009-06-09  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/40351
* tree-sra.c (propagate_subacesses_accross_link): Check that a refrence
to a potential artifical subaccess can be constructed.

* testsuite/gcc.c-torture/compile/pr40351.c: New file.

From-SVN: r148315

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr40351.c [new file with mode: 0644]
gcc/tree-sra.c

index fc4bad1f35ce4a0652cbb9b270da48e6091d920b..e2b443706b1d7324b5c3870fcadb3de26cc4fb81 100644 (file)
@@ -1,3 +1,9 @@
+2009-06-09  Martin Jambor  <mjambor@suse.cz>
+
+       PR tree-optimization/40351
+       * tree-sra.c (propagate_subacesses_accross_link): Check that a refrence
+       to a potential artifical subaccess can be constructed.
+
 2009-06-08  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        * config/sh/sh-protos.h (sh_optimization_options): Declare.
index cb9ec0c3f351a8badeb5537aa810c20f562e3348..8ecbde7ad3a12656d66c61427d20b53303d51d10 100644 (file)
@@ -1,3 +1,7 @@
+2009-06-09  Martin Jambor  <mjambor@suse.cz>
+
+       * testsuite/gcc.c-torture/compile/pr40351.c: New file.
+
 2009-06-09  Olivier Hainque  <hainque@adacore.com>
 
        * gnat.dg/align_max.adb: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40351.c b/gcc/testsuite/gcc.c-torture/compile/pr40351.c
new file mode 100644 (file)
index 0000000..9b7e0cc
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR tree-optimizations/40351 */
+
+struct IO_APIC_route_entry {
+    unsigned int vector : 8;
+    unsigned int delivery_mode : 1;
+    unsigned int mask : 1;
+    unsigned int __reserved_2 : 15;
+    unsigned int __reserved_3 : 8;
+} __attribute__ ((packed));
+union entry_union {
+    struct {
+        unsigned int w1, w2;
+    };
+    struct IO_APIC_route_entry entry;
+};
+unsigned int io_apic_read(void);
+struct IO_APIC_route_entry ioapic_read_entry(void)
+{
+  union entry_union eu;
+  eu.w1 = io_apic_read();
+  return eu.entry;
+}
index 825d6e80ae7dc0e127d76e5ae4401a5606aa2993..e5f9b96c41917f744713e46e14be16ba235cd215 100644 (file)
@@ -1544,6 +1544,13 @@ propagate_subacesses_accross_link (struct access *lacc, struct access *racc)
          continue;
        }
 
+      /* If a (part of) a union field in on the RHS of an assignment, it can
+        have sub-accesses which do not make sense on the LHS (PR 40351).
+        Check that this is not the case.  */
+      if (!build_ref_for_offset (NULL, TREE_TYPE (lacc->base), norm_offset,
+                                rchild->type, false))
+       continue;
+
       new_acc = create_artificial_child_access (lacc, rchild, norm_offset);
       if (racc->first_child)
        propagate_subacesses_accross_link (new_acc, rchild);