[Bug middle-end/64568] [5 Regression] error: invalid reference prefix

2015-01-16 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64568

Markus Trippelsdorf trippels at gcc dot gnu.org changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #6 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
I still happens running the Boost testsuite on ppc64:


trippels@gcc2-power8 status % g++ -c -O3 -std=c++11 test22.ii
In file included from ../libs/numeric/ublas/test/test2.hpp:22:0,
 from ../libs/numeric/ublas/test/test22.cpp:13:
../boost/numeric/ublas/blas.hpp: In function ‘M
boost::numeric::ublas::blas_2::hr2(M, const T, const V1, const V2) [with M
= boost::numeric::ublas::matrixstd::complexdouble ; T =
std::complexdouble; V1 = boost::numeric::ublas::vectorstd::complexdouble
; V2 = boost::numeric::ublas::vectorstd::complexdouble ]’:
../boost/numeric/ublas/blas.hpp:330:13: error: invalid reference prefix
 M  hr2 (M m, const T t, const V1 v1, const V2 v2)
 ^
MEM[base: _216, index: ivtmp.1531_157, offset: 0]
cc1plus: note: in statement
# VUSE .MEM_156
_158 = IMAGPART_EXPR MEM[base: _216, index: ivtmp.1531_157, offset: 0];
../boost/numeric/ublas/blas.hpp:330:13: error: invalid reference prefix
MEM[base: _216, index: ivtmp.1531_157, offset: 0]
cc1plus: note: in statement
# VUSE .MEM_156
_91 = REALPART_EXPR MEM[base: _216, index: ivtmp.1531_157, offset: 0];
../boost/numeric/ublas/blas.hpp:330:13: internal compiler error: verify_gimple
failed
0x10a48a6f verify_gimple_in_cfg(function*, bool)
../../gcc/gcc/tree-cfg.c:5069
0x10903e53 execute_function_todo
../../gcc/gcc/passes.c:1955
0x10904a93 do_per_function
../../gcc/gcc/passes.c:1647
0x10904d67 execute_todo
../../gcc/gcc/passes.c:2012
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See http://gcc.gnu.org/bugs.html for instructions.


Reducing...

[Bug middle-end/64568] [5 Regression] error: invalid reference prefix

2015-01-16 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64568

--- Comment #7 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
trippels@gcc2-power8 status % cat test22.ii
namespace std
{
typedef long unsigned size_t;
}
class H;
namespace std
{
template typename struct complex;
template typename _Tp
complex_Tp operator+(complex_Tp __x, complex_Tp __y)
{
  complex_Tp a = __x;
  a += __y;
  return a;
}
template  struct complexdouble
{
  int
  imag ()
  {
return __imag__ _M_value;
  }
  void operator+=(complex __z) { _M_value += _M_value; _M_value  += __z.imag
(); }
  _Complex double _M_value;
};
}
struct A
{
  typedef std::complexdouble const_reference;
};
class B
{
public:
  B (int);
  std::complexdouble operator[](int i) { return data_[i]; }
  std::complexdouble *data_;
};
struct C
{
  static std::complexdouble
  apply (A::const_reference t1, std::complexdouble t2)
  {
return t1 + t2;
  }
  typedef std::complexdouble result_type;
};
template class T1, class struct D
{
  static void
  apply (T1 t1, std::complexdouble t2)
  {
t1 = t2;
  }
};
class ublas_expression
{
public:
  ~ublas_expression ();
};
template class class F
{
};
template class E class matrix_expression : ublas_expression
{
public:
  E operator()() {}
};
class I : public Fint
{
public:
  typedef int value_type;
  I (int);
};
template class E1, class E2 matrix_expressionint outer_prod (FE1, FE2);
template class E1, class F class J : public matrix_expressionJE1, F 
{
public:
  typedef typename F::result_type value_type;
  value_type operator()(int i, int)
  {
return F::apply (e1_ (i, 0), e2_ (0, 0));
  }
  E1 e1_;
  E1 e2_;
};
template class E1, class E2
JH, C operator+(matrix_expressionE1, matrix_expressionE2);
template template class, class class F, class M, class E
void
indexing_matrix_assign (M m, matrix_expressionE e, int)
{
  for (int i; i; ++i)
Ftypename M::reference, typename E::value_type::apply (m (0, 0),
 e ()(i, 0));
}
template template class, class class F, class, class M, class E, class C
void
matrix_assign (M m, matrix_expressionE e, int, C)
{
  indexing_matrix_assignF (m, e, 0);
}
template template class, class class F, class M, class E
void
matrix_assign (M m, matrix_expressionE e)
{
  matrix_assignF, int (m, e, 0, typename M::orientation_category ());
}
class H : matrix_expressionint
{
public:
  typedef std::complexdouble reference;
  typedef int orientation_category;
  H (int, int) : data_ (0) {}
  template class AE H (matrix_expressionAE ae) : data_ (0)
  {
matrix_assignD (*this, ae);
  }
  B 
  data ()
  {
  }
  std::complexdouble operator()(int i, int) { return data ()[i]; }
  void operator+=(matrix_expression ae) { H (*this + ae); }
  B data_;
};
template class M, class T, class V1, class V2
void
sr2 (M m, T, V1 v1, V2 v2)
{
  m += outer_prod (v2, v1);
}
template class, class, unsigned long struct G
{
  void test ();
};
template struct GI, H, 3;
template class V, class M, std::size_t N
void
GV, M, N::test ()
{
  V b (0), c (0);
  M m (0, 0);
  sr2 (m, typename V::value_type (), b, c);
}

trippels@gcc2-power8 status % g++ -c -O2 -std=c++11 test22.ii
test22.ii: In member function ‘void G template-parameter-1-1,
template-parameter-1-2, anonymous ::test() [with template-parameter-1-1
= I; template-parameter-1-2 = H; long unsigned int anonymous = 3ul]’:
test22.ii:139:1: error: invalid reference prefix
 GV, M, N::test ()
 ^
MEM[base: _44, offset: 0]
cc1plus: note: in statement
# VUSE .MEM_59
_26 = IMAGPART_EXPR MEM[base: _44, offset: 0];
test22.ii:139:1: error: invalid reference prefix
MEM[base: _44, offset: 0]
cc1plus: note: in statement
# VUSE .MEM_59
_51 = REALPART_EXPR MEM[base: _44, offset: 0];
test22.ii:139:1: internal compiler error: verify_gimple failed

[Bug middle-end/64568] [5 Regression] error: invalid reference prefix

2015-01-16 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64568

--- Comment #8 from Richard Biener rguenth at gcc dot gnu.org ---
Author: rguenth
Date: Fri Jan 16 13:21:11 2015
New Revision: 219736

URL: https://gcc.gnu.org/viewcvs?rev=219736root=gccview=rev
Log:
2015-01-16  Richard Biener  rguent...@suse.de

PR tree-optimization/64568
* tree-ssa-forwprop.c (pass_forwprop::execute): Guard
complex load rewriting for TARGET_MEM_REFs.

* g++.dg/torture/pr64568-2.C: New testcase.

Added:
trunk/gcc/testsuite/g++.dg/torture/pr64568-2.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-forwprop.c


[Bug middle-end/64568] [5 Regression] error: invalid reference prefix

2015-01-16 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64568

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Richard Biener rguenth at gcc dot gnu.org ---
Fixed.


[Bug middle-end/64568] [5 Regression] error: invalid reference prefix

2015-01-16 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64568

Markus Trippelsdorf trippels at gcc dot gnu.org changed:

   What|Removed |Added

 CC||dcb314 at hotmail dot com

--- Comment #10 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
*** Bug 64630 has been marked as a duplicate of this bug. ***


[Bug middle-end/64568] [5 Regression] error: invalid reference prefix

2015-01-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64568

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Richard Biener rguenth at gcc dot gnu.org ---
Fixed.


[Bug middle-end/64568] [5 Regression] error: invalid reference prefix

2015-01-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64568

--- Comment #5 from Richard Biener rguenth at gcc dot gnu.org ---
Author: rguenth
Date: Tue Jan 13 08:32:13 2015
New Revision: 219520

URL: https://gcc.gnu.org/viewcvs?rev=219520root=gccview=rev
Log:
2014-01-13  Richard Biener  rguent...@suse.de

PR tree-optimization/64568
* tree-ssa-forwprop.c (pass_forwprop::execute): Properly
release defs of removed stmts, avoid splitting TARGET_MEM_REFs.

* g++.dg/torture/pr64568.C: New testcase.

Added:
trunk/gcc/testsuite/g++.dg/torture/pr64568.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-forwprop.c


[Bug middle-end/64568] [5 Regression] error: invalid reference prefix

2015-01-12 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64568

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P1
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2015-01-12
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org
   Target Milestone|--- |5.0
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener rguenth at gcc dot gnu.org ---
Hmm, indeed we shouldn't subset TARGET_MEM_REFs.  Mine (waiting for a
testcase).


[Bug middle-end/64568] [5 Regression] error: invalid reference prefix

2015-01-12 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64568

--- Comment #2 from Richard Biener rguenth at gcc dot gnu.org ---
Index: gcc/tree-ssa-forwprop.c
===
--- gcc/tree-ssa-forwprop.c (revision 219446)
+++ gcc/tree-ssa-forwprop.c (working copy)
@@ -2281,7 +2281,9 @@ pass_forwprop::execute (function *fun)
  if (single_imm_use (lhs, use_p, use_stmt)
   gimple_store_p (use_stmt)
   !gimple_has_volatile_ops (use_stmt)
-  is_gimple_assign (use_stmt))
+  is_gimple_assign (use_stmt)
+  (TREE_CODE (gimple_assign_lhs (use_stmt))
+ != TARGET_MEM_REF))
{
  tree use_lhs = gimple_assign_lhs (use_stmt);
  tree new_lhs = build1 (REALPART_EXPR,

probably fixes it.


[Bug middle-end/64568] [5 Regression] error: invalid reference prefix

2015-01-12 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64568

--- Comment #3 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
Here's a target-independent testcase:

 % cat test21.ii
namespace std
{
typedef long unsigned size_t;
template typename class complex;
template typename _Tp complex_Tp operator+(complex_Tp, complex_Tp)
{
  complex_Tp a = 0;
  a += 0;
  return a;
}
template  struct complexdouble
{
  complex (int __i) : _M_value{ __i } {}
  int imag ();
  void operator+=(complex __z) { _M_value = __z.imag (); }
  _Complex double _M_value;
};
}
class A
{
public:
  A (int);
  std::complexdouble operator[](int i) { return data_[i]; }
  std::complexdouble *data_;
};
struct B
{
  static std::complexdouble
  apply (std::complexdouble t1, std::complexdouble t2)
  {
return t1 + t2;
  }
};
template class T1, class struct C
{
  static void
  apply (T1 t1, std::complexdouble t2)
  {
t1 = t2;
  }
};
template class E class D
{
public:
  E operator()();
};
class G : public DG
{
public:
  typedef std::complexdouble value_type;
  value_type operator()(int) { return B::apply (0, 0); }
};
template class E1, class E2 G operator+(DE1, DE2);
template template class, class class F, class V, class E
void
indexing_vector_assign (V v, DE e)
{
  for (int i;; ++i)
Ftypename V::reference, typename E::value_type::apply (v (i), e ()(0));
}
template template class, class class F, class V, class E
void
vector_assign (V v, DE e, int)
{
  indexing_vector_assignF (v, e);
}
template template class, class class F, class V, class E
void
vector_assign (V v, DE e)
{
  vector_assignF (v, e, typename V::storage_category ());
}
class H : public Dint
{
public:
  typedef std::complexdouble reference;
  typedef int storage_category;
  H (int);
  template class AE H (DAE ae) : data_ (0)
  {
vector_assignC (*this, ae);
  }
  A
  data ()
  {
return data_;
  }
  reference operator()(int i) { return data ()[i]; }
  A data_;
};
template class T1, class V1, class T2, class V2
void
rot (T1, V1 v1, T2, V2 v2)
{
  H (v1 + v2);
}
template class, unsigned long struct F
{
  void test ();
};
template struct FH, 3;
template class V, std::size_t N
void
FV, N::test ()
{
  V b (0), c (0);
  rot (0, b, 0, c);
}

 % g++ -O2 -std=c++11 test21.ii
test21.ii: In member function ‘void F template-parameter-1-1, anonymous
::test() [with template-parameter-1-1 = H; long unsigned int anonymous =
3ul]’:
test21.ii:104:1: error: invalid reference prefix
 FV, N::test ()
 ^
MEM[base: _25, offset: 0B]
cc1plus: note: in statement
# .MEM_8 = VDEF .MEM_30
REALPART_EXPR MEM[base: _25, offset: 0B] = _18;
test21.ii:104:1: error: invalid reference prefix
MEM[base: _25, offset: 0B]
test21.ii:39:5: note: in statement
 t1 = t2;
 ^
# .MEM_33 = VDEF .MEM_8
IMAGPART_EXPR MEM[base: _25, offset: 0B] = 0.0;
test21.ii:104:1: internal compiler error: verify_gimple failed
 FV, N::test ()
 ^
0x10a34f8f verify_gimple_in_cfg(function*, bool)
../../gcc/gcc/tree-cfg.c:5056
0x108f1b53 execute_function_todo
../../gcc/gcc/passes.c:1946
0x108f2793 do_per_function
../../gcc/gcc/passes.c:1638
0x108f2a67 execute_todo
../../gcc/gcc/passes.c:2003
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug re