tree-ssa-dse.c (compute_trims): Handle case where the reference's type does not have...
authorJeff Law <law@redhat.com>
Mon, 27 Aug 2018 20:31:14 +0000 (14:31 -0600)
committerJeff Law <law@gcc.gnu.org>
Mon, 27 Aug 2018 20:31:14 +0000 (14:31 -0600)
* tree-ssa-dse.c (compute_trims): Handle case where the reference's
type does not have a TYPE_SIZE_UNIT.

* gcc.c-torture/compile/dse.c: New test.

From-SVN: r263896

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

index ac46b7422bcac01f799ad9ece01e699755fb33e8..a8ab83580b5038c78e2b1a141e54442f9852e842 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-27  Jeff Law  <law@redhat.com>
+
+       * tree-ssa-dse.c (compute_trims): Handle case where the reference's
+       type does not have a TYPE_SIZE_UNIT.
+
 2018-08-27  Steve Ellcey  <sellcey@cavium.com>
 
        * config/aarch64/aarch64-speculation.cc: Replace include of cfg.h
index 824372c346a6ecc04897807f9ee800851cf9498e..6410f4638cc3dc9ef01e416bfcdae3518b88c8ea 100644 (file)
@@ -1,3 +1,7 @@
+2018-08-27  Jeff Law  <law@redhat.com>
+
+       * gcc.c-torture/compile/dse.c: New test.
+
 2018-08-27  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/86993
diff --git a/gcc/testsuite/gcc.c-torture/compile/dse.c b/gcc/testsuite/gcc.c-torture/compile/dse.c
new file mode 100644 (file)
index 0000000..908e650
--- /dev/null
@@ -0,0 +1,19 @@
+typedef unsigned long microblaze_reg_t;
+struct pt_regs
+{
+  microblaze_reg_t msr;
+  int pt_mode;
+};
+struct task_struct
+{
+  void *stack;
+};
+int
+copy_thread (struct task_struct *p)
+{
+  struct pt_regs *childregs =
+    (((struct pt_regs *) ((1 << 13) + ((void *) (p)->stack))) - 1);
+  memset (childregs, 0, sizeof (struct pt_regs));
+  childregs->pt_mode = 1;
+}
+
index 016aa6cc97c7b5131bbb4c6682a9eb2d0e3beff5..bddbbe8377a8fa80ad9929805551cce14eb05f51 100644 (file)
@@ -252,6 +252,7 @@ compute_trims (ao_ref *ref, sbitmap live, int *trim_head, int *trim_tail,
       /* But don't trim away out of bounds accesses, as this defeats
         proper warnings.  */
       if (*trim_tail
+         && TYPE_SIZE_UNIT (TREE_TYPE (ref->base))
          && compare_tree_int (TYPE_SIZE_UNIT (TREE_TYPE (ref->base)),
                               last_orig) <= 0)
        *trim_tail = 0;