From 46ab5b6edea83d9eb67a83572171493a8e2283b5 Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Mon, 6 Jun 2016 23:41:26 +0000 Subject: [PATCH] re PR target/71281 (ICE on gcc trunk on knl, wsm, ivb and bdw targets (tree-ssa-reassoc)) gcc/ChangeLog: 2016-06-07 Kugan Vivekanandarajah PR middle-end/71281 * tree-ssa-reassoc.c (reassociate_bb): Set uid for negate stmt. gcc/testsuite/ChangeLog: 2016-06-07 Kugan Vivekanandarajah PR middle-end/71281 * g++.dg/torture/pr71281.C: New test. From-SVN: r237157 --- gcc/ChangeLog | 5 ++ gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/g++.dg/torture/pr71281.C | 63 ++++++++++++++++++++++++++ gcc/tree-ssa-reassoc.c | 1 + 4 files changed, 74 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr71281.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 18f491a6dcb..d586f9b3cf1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-06-07 Kugan Vivekanandarajah + + PR middle-end/71281 + * tree-ssa-reassoc.c (reassociate_bb): Set uid for negate stmt. + 2016-06-07 Uros Bizjak * config/i386/i386.h (enum ix86_enitity): Add X86_DIRFLAG. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e292f547f39..81d2fd52f1a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-07 Kugan Vivekanandarajah + + PR middle-end/71281 + * g++.dg/torture/pr71281.C: New test. + 2016-06-06 Marek Polacek PR c/71362 diff --git a/gcc/testsuite/g++.dg/torture/pr71281.C b/gcc/testsuite/g++.dg/torture/pr71281.C new file mode 100644 index 00000000000..7d429a95b1b --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr71281.C @@ -0,0 +1,63 @@ +// PR middle-end/71281 +// { dg-do compile } +// { dg-additional-options "-std=c++11 -Ofast" } + + +template struct A; +template struct A<_Tp *> { typedef _Tp reference; }; + +template class B { +public: + typename A<_Iterator>::reference operator*(); +}; + +template class C; +template struct D; + +template struct D> { + using value_type = _Tp; + using const_pointer = _Tp *; + template using rebind_alloc = C<_Up>; +}; + +template struct __alloc_traits : D<_Alloc> { + typedef D<_Alloc> _Base_type; + typedef typename _Base_type::value_type &reference; + template struct F { + typedef typename _Base_type::template rebind_alloc<_Tp> other; + }; +}; + +template struct G { + typedef typename __alloc_traits<_Alloc>::template F<_Tp>::other + _Tp_alloc_type; +}; + +int a, b; +long d[1][1][1]; +void fn1() __attribute__((__noreturn__)); +template > class H { + typedef __alloc_traits::_Tp_alloc_type> _Alloc_traits; + typedef typename _Alloc_traits::reference reference; + +public: + B m_fn1(); + long m_fn2(); + reference operator[](unsigned); + reference m_fn3(unsigned){ + if (m_fn2()) + fn1(); + } +}; + +H>> c; +void fn2() { + H> e; + for (int f = 1;;) + for (int g = 0;;) + for (int h = 0;;) + { + *d[0][h] = + c.m_fn3(f)[0][g] * a + -*(e).m_fn1() * b + (*c[f].m_fn1()).m_fn3(g); + } +} diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 1973077db7c..096b24dc1d3 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -5387,6 +5387,7 @@ reassociate_bb (basic_block bb) gimple_set_lhs (stmt, tmp); gassign *neg_stmt = gimple_build_assign (lhs, NEGATE_EXPR, tmp); + gimple_set_uid (neg_stmt, gimple_uid (stmt)); gimple_stmt_iterator gsi = gsi_for_stmt (stmt); gsi_insert_after (&gsi, neg_stmt, GSI_NEW_STMT); update_stmt (stmt); -- 2.30.2