[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  changed:

   What|Removed |Added

 CC||dcb314 at hotmail dot com

--- Comment #10 from Markus Trippelsdorf  ---
*** Bug 64630 has been marked as a duplicate of this bug. ***


[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  changed:

   What|Removed |Added

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

--- Comment #9 from Richard Biener  ---
Fixed.


[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  ---
Author: rguenth
Date: Fri Jan 16 13:21:11 2015
New Revision: 219736

URL: https://gcc.gnu.org/viewcvs?rev=219736&root=gcc&view=rev
Log:
2015-01-16  Richard Biener  

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 trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64568

--- Comment #7 from Markus Trippelsdorf  ---
trippels@gcc2-power8 status % cat test22.ii
namespace std
{
typedef long unsigned size_t;
}
class H;
namespace std
{
template  struct complex;
template 
complex<_Tp> operator+(complex<_Tp> &__x, complex<_Tp> __y)
{
  complex<_Tp> a = __x;
  a += __y;
  return a;
}
template <> struct complex
{
  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::complex &const_reference;
};
class B
{
public:
  B (int);
  std::complex &operator[](int i) { return data_[i]; }
  std::complex *data_;
};
struct C
{
  static std::complex
  apply (A::const_reference t1, std::complex t2)
  {
return t1 + t2;
  }
  typedef std::complex result_type;
};
template  struct D
{
  static void
  apply (T1 t1, std::complex t2)
  {
t1 = t2;
  }
};
class ublas_expression
{
public:
  ~ublas_expression ();
};
template  class F
{
};
template  class matrix_expression : ublas_expression
{
public:
  E &operator()() {}
};
class I : public F
{
public:
  typedef int value_type;
  I (int);
};
template  matrix_expression outer_prod (F, F);
template  class J : public matrix_expression >
{
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 
J operator+(matrix_expression, matrix_expression);
template  class F, class M, class E>
void
indexing_matrix_assign (M m, matrix_expression e, int)
{
  for (int i; i; ++i)
F::apply (m (0, 0),
 e ()(i, 0));
}
template  class F, class, class M, class E, class C>
void
matrix_assign (M m, matrix_expression e, int, C)
{
  indexing_matrix_assign (m, e, 0);
}
template  class F, class M, class E>
void
matrix_assign (M m, matrix_expression e)
{
  matrix_assign (m, e, 0, typename M::orientation_category ());
}
class H : matrix_expression
{
public:
  typedef std::complex &reference;
  typedef int orientation_category;
  H (int, int) : data_ (0) {}
  template  H (matrix_expression ae) : data_ (0)
  {
matrix_assign (*this, ae);
  }
  B &
  data ()
  {
  }
  std::complex &operator()(int i, int) { return data ()[i]; }
  void operator+=(matrix_expression ae) { H (*this + ae); }
  B data_;
};
template 
void
sr2 (M m, T, V1 v1, V2 v2)
{
  m += outer_prod (v2, v1);
}
template  struct G
{
  void test ();
};
template struct G;
template 
void
G::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< ,
,  >::test() [with 
= I;  = H; long unsigned int  = 3ul]’:
test22.ii:139:1: error: invalid reference prefix
 G::test ()
 ^
MEM[base: _44, offset: 0]
cc1plus: note: in statement
# VUSE <.MEM_59>
_26 = IMAGPART_EXPR ;
test22.ii:139:1: error: invalid reference prefix
MEM[base: _44, offset: 0]
cc1plus: note: in statement
# VUSE <.MEM_59>
_51 = REALPART_EXPR ;
test22.ii:139:1: internal compiler error: verify_gimple failed

[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  changed:

   What|Removed |Added

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

--- Comment #6 from Markus Trippelsdorf  ---
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::matrix >; T =
std::complex; V1 = boost::numeric::ublas::vector
>; V2 = boost::numeric::ublas::vector >]’:
../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 ;
../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 ;
../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  for instructions.


Reducing...

[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  changed:

   What|Removed |Added

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

--- Comment #4 from Richard Biener  ---
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  ---
Author: rguenth
Date: Tue Jan 13 08:32:13 2015
New Revision: 219520

URL: https://gcc.gnu.org/viewcvs?rev=219520&root=gcc&view=rev
Log:
2014-01-13  Richard Biener  

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 trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64568

--- Comment #3 from Markus Trippelsdorf  ---
Here's a target-independent testcase:

 % cat test21.ii
namespace std
{
typedef long unsigned size_t;
template  class complex;
template  complex<_Tp> operator+(complex<_Tp>, complex<_Tp>)
{
  complex<_Tp> a = 0;
  a += 0;
  return a;
}
template <> struct complex
{
  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::complex &operator[](int i) { return data_[i]; }
  std::complex *data_;
};
struct B
{
  static std::complex
  apply (std::complex t1, std::complex t2)
  {
return t1 + t2;
  }
};
template  struct C
{
  static void
  apply (T1 t1, std::complex t2)
  {
t1 = t2;
  }
};
template  class D
{
public:
  E operator()();
};
class G : public D
{
public:
  typedef std::complex value_type;
  value_type operator()(int) { return B::apply (0, 0); }
};
template  G operator+(D, D);
template  class F, class V, class E>
void
indexing_vector_assign (V v, D e)
{
  for (int i;; ++i)
F::apply (v (i), e ()(0));
}
template  class F, class V, class E>
void
vector_assign (V v, D e, int)
{
  indexing_vector_assign (v, e);
}
template  class F, class V, class E>
void
vector_assign (V v, D e)
{
  vector_assign (v, e, typename V::storage_category ());
}
class H : public D
{
public:
  typedef std::complex &reference;
  typedef int storage_category;
  H (int);
  template  H (D ae) : data_ (0)
  {
vector_assign (*this, ae);
  }
  A
  data ()
  {
return data_;
  }
  reference operator()(int i) { return data ()[i]; }
  A data_;
};
template 
void
rot (T1, V1 v1, T2, V2 v2)
{
  H (v1 + v2);
}
template  struct F
{
  void test ();
};
template struct F;
template 
void
F::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< , 
>::test() [with  = H; long unsigned int  =
3ul]’:
test21.ii:104:1: error: invalid reference prefix
 F::test ()
 ^
MEM[base: _25, offset: 0B]
cc1plus: note: in statement
# .MEM_8 = VDEF <.MEM_30>
REALPART_EXPR  = _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  = 0.0;
test21.ii:104:1: internal compiler error: verify_gimple failed
 F::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

[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  ---
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 rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64568

Richard Biener  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  ---
Hmm, indeed we shouldn't subset TARGET_MEM_REFs.  Mine (waiting for a
testcase).