From 6a2a69287c6cbcfa31cd9dcb13cfdf40cdd29d8e Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 27 Aug 2018 14:31:14 -0600 Subject: [PATCH] tree-ssa-dse.c (compute_trims): Handle case where the reference's type does not have a TYPE_SIZE_UNIT. * 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 | 5 +++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.c-torture/compile/dse.c | 19 +++++++++++++++++++ gcc/tree-ssa-dse.c | 1 + 4 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/dse.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ac46b7422bc..a8ab83580b5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-08-27 Jeff Law + + * 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 * config/aarch64/aarch64-speculation.cc: Replace include of cfg.h diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 824372c346a..6410f4638cc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-08-27 Jeff Law + + * gcc.c-torture/compile/dse.c: New test. + 2018-08-27 Jakub Jelinek 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 index 00000000000..908e6503eb4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/dse.c @@ -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; +} + diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 016aa6cc97c..bddbbe8377a 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -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; -- 2.30.2