From: Jakub Jelinek Date: Thu, 14 Jul 2016 18:30:38 +0000 (+0200) Subject: re PR tree-optimization/71872 (ICE in inchash::add_expr, at tree.c:7782 - OEP_ADDRESS... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a241f8ca212b7f27a986e495c15d6890d0dbb44e;p=gcc.git re PR tree-optimization/71872 (ICE in inchash::add_expr, at tree.c:7782 - OEP_ADDRESS_OF asserted for ADDR_EXPR applied to constant) PR tree-optimization/71872 * tree-data-ref.c (get_references_in_stmt): Ignore references with is_gimple_constant get_base_address. * gcc.c-torture/compile/pr71872.c: New test. From-SVN: r238351 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e62f2d8fc9c..8da237861a1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-07-14 Jakub Jelinek + + PR tree-optimization/71872 + * tree-data-ref.c (get_references_in_stmt): Ignore references + with is_gimple_constant get_base_address. + 2016-07-14 Thomas Preud'homme * config/arm/arm.h (TARGET_HAVE_LDACQ): Enable for ARMv8-M Mainline. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 95705821eb1..6b0c7b8a1b5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-07-14 Jakub Jelinek + + PR tree-optimization/71872 + * gcc.c-torture/compile/pr71872.c: New test. + 2016-07-14 Thomas Preud'homme * gcc.target/arm/atomic-comp-swap-release-acquire.c: Rename into ... diff --git a/gcc/testsuite/gcc.c-torture/compile/pr71872.c b/gcc/testsuite/gcc.c-torture/compile/pr71872.c new file mode 100644 index 00000000000..6db80db89f3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr71872.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/71872 */ + +struct __attribute__((may_alias)) S { int a; }; + +void +foo (int *x, struct S *y) +{ + int i; + for (i = 0; i < 16; i++) + { + int a = 0; + if (*x) + *(struct S *) y = *(struct S *) &a; + } +} diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 337d278790a..081ee603193 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -3868,7 +3868,8 @@ get_references_in_stmt (gimple *stmt, vec *references) if (DECL_P (op1) || (REFERENCE_CLASS_P (op1) && (base = get_base_address (op1)) - && TREE_CODE (base) != SSA_NAME)) + && TREE_CODE (base) != SSA_NAME + && !is_gimple_min_invariant (base))) { ref.ref = op1; ref.is_read = true;