/* PR tree-optimization/112822 */ /* { dg-do compile { target c++17 } } */ /* { dg-options "-w -O2" } */ /* Verify we do not ICE on the following noisy creduced test case. */ namespace b { typedef int c; template struct d; template struct d { using f = e; }; template struct aa; template struct aa { using f = h; }; template using ab = typename d::f; template using n = typename aa::f; template class af { public: typedef __complex__ ah; template af operator+=(e) { ah o; x = o; return *this; } ah x; }; } // namespace b namespace { enum { p }; enum { ac, ad }; struct ae; struct al; struct ag; typedef b::c an; namespace ai { template struct ak { typedef aj f; }; template using ar = typename ak::f; template struct am { enum { at }; }; template struct ao { enum { at }; }; template struct ap; template struct aq { enum { at }; }; } // namespace ai template struct ay; template class as; template class ba; template class aw; template class be; template class az; namespace ai { template struct bg; template ::bd> struct bk; template struct bf; template struct bm; template struct bh; template ::bj>::at> struct bp { typedef bi f; }; template struct br { typedef typename bp::f>::f f; }; template struct bn; template struct bn { typedef aw f; }; template struct bx { typedef typename bn::bs, aj ::bo>::f f; }; template struct bt { typedef b::n<0, aj, aj> f; }; template ::f> struct cb { enum { bw }; typedef b::n::f> f; }; template ::bs> struct by { typedef be f; }; template struct bz { typedef typename by::f f; }; template struct ch; template struct ch { typedef ci bd; }; } // namespace ai template > struct cg; template struct cg { typedef aj cn; }; namespace ai { template cj cp; template void cl(bu *cr, cj cs) { ct(cr, cs); } typedef __attribute__((altivec(vector__))) double co; void ct(double *cr, co cs) { *(co *)cr = cs; } struct cq { co q; }; template <> struct bm> { typedef cq f; }; template <> struct bh { typedef cq bj; }; void ct(b::af *cr, cq cs) { ct((double *)cr, cs.q); } template struct cx { template void cu(cw *a, cj) { cl(a, cp); } }; } // namespace ai template class ba : public ay { public: typedef ai::ap bu; typedef b::n::bo, bu, b::n::at, bu, bu>> cv; typedef ay db; db::dc; cv coeff(an dd, an col) const { return dc().coeff(dd, col); } }; template class cz : public ba::at> { public: ai::ap b; enum { da, dg, dh, bv, bq, di = dg, bo }; }; template class be : public cz { public: typedef typename ai::ap::bu bu; typedef cz db; db::dc; template cd &operator+=(const be &); template az df(de); }; template struct ay { cd &dc() { return *static_cast(this); } cd dc() const; }; template class dl; namespace ai { template struct ap> { typedef bb dj; typedef bc r; typedef ap s; typedef ap t; typedef typename cg::cn bu; typedef typename ch::bd>::bd cf; enum { bo }; }; } // namespace ai template class az : public dl, ai::ap, ai::bg::bd>> { public: typedef dk bb; typedef Rhs_ bc; typedef typename ai::bt::f LhsNested; typedef typename ai::bt::f dn; typedef ai::ar u; typedef ai::ar RhsNestedCleaned; u lhs(); RhsNestedCleaned rhs(); }; template class dl : public ai::bz, al>::f {}; namespace ai { template struct v { typedef ag w; }; template struct evaluator_traits_base { typedef typename v::cf>::w w; }; template struct ax : evaluator_traits_base {}; template struct y { static const bool at = false; }; template class plainobjectbase_evaluator_data { public: plainobjectbase_evaluator_data(bu *ptr, an) : data(ptr) {} an outerStride() { return z; } bu *data; }; template struct evaluator { typedef cd PlainObjectType; typedef typename PlainObjectType::bu bu; enum { IsVectorAtCompileTime }; enum { OuterStrideAtCompileTime }; evaluator(PlainObjectType &m) : m_d(m.data(), IsVectorAtCompileTime) {} bu &coeffRef(an, an) { return m_d.data[m_d.outerStride()]; } plainobjectbase_evaluator_data m_d; }; template struct evaluator> : evaluator>> { typedef aw XprType; evaluator(XprType &m) : evaluator>(m) {} }; template struct copy_using_evaluator_traits { typedef typename DstEvaluator::bu cw; enum { RestrictedInnerSize }; typedef typename br::f bi; }; template struct copy_using_evaluator_innervec_CompleteUnrolling { typedef typename Kernel::bi bi; enum { outer, inner, SrcAlignment, DstAlignment }; static void run(Kernel kernel) { kernel.template assignPacketByOuterInner( outer, inner); } }; template struct dense_assignment_loop { static void run(Kernel kernel) { typedef typename Kernel::DstEvaluatorType::XprType DstXprType; copy_using_evaluator_innervec_CompleteUnrolling< Kernel, 0, DstXprType::dh>::run(kernel); } }; template class generic_dense_assignment_kernel { typedef typename DstEvaluatorTypeT::XprType DstXprType; public: typedef DstEvaluatorTypeT DstEvaluatorType; typedef SrcEvaluatorTypeT SrcEvaluatorType; typedef copy_using_evaluator_traits AssignmentTraits; typedef typename AssignmentTraits::bi bi; generic_dense_assignment_kernel(DstEvaluatorType dst, SrcEvaluatorType src, Functor, DstXprType dstExpr) : m_dst(dst), m_src(src), m_dstExpr(dstExpr) {} template void cu(an dd, an col) { m_functor.template cu( &m_dst.coeffRef(dd, col), m_src.template packet(dd, col)); } template void assignPacketByOuterInner(an, an) { an dd; an col; cu(dd, col); } DstEvaluatorType m_dst; SrcEvaluatorType &m_src; Functor m_functor; DstXprType m_dstExpr; }; template void call_dense_assignment_loop(DstXprType &dst, SrcXprType src, Functor func) { typedef evaluator DstEvaluatorType; typedef evaluator SrcEvaluatorType; SrcEvaluatorType srcEvaluator(src); DstEvaluatorType dstEvaluator(dst); typedef generic_dense_assignment_kernel Kernel; Kernel kernel(dstEvaluator, srcEvaluator, func, dst); dense_assignment_loop::run(kernel); } template struct AssignmentKind; struct Dense2Dense; template <> struct AssignmentKind { typedef Dense2Dense Kind; }; template ::w, typename ax::w>::Kind, typename = void> struct Assignment; template void call_assignment(Dst &dst, Src src, Func func, b::ab::at, void *> = 0) { enum { NeedToTranspose }; typedef b::n ActualDstTypeCleaned; typedef b::n ActualDstType; ActualDstType actualDst(dst); Assignment::run(actualDst, src, func); } template struct Assignment { static void run(DstXprType &dst, SrcXprType src, Functor func) { call_dense_assignment_loop(dst, src, func); } }; template struct plain_array { aj array[bl]; }; } // namespace ai template class DenseStorage { ai::plain_array m_data; public: an cols() { return av; } aj *data() { return m_data.array; } }; template class as : public ai::by::f { public: enum { Options }; typedef typename ai::by::f db; typedef typename ai::ap::bu bu; DenseStorage m_storage; an cols() { return m_storage.cols(); } bu &coeffRef(an, an colId) { return data()[colId]; } bu *data() { return m_storage.data(); } }; namespace ai { template struct ap> { typedef Scalar_ bu; typedef ae cf; typedef al bs; enum { bo }; }; } // namespace ai template class aw : public as> { public: template aw(T0, T1) {} }; template template cd &be::operator+=(const be &other) { call_assignment(dc(), other.dc(), ai::cx()); return dc(); } namespace ai { template struct bg { enum { bd }; }; template struct evaluator> : bk> { typedef az XprType; typedef bk db; evaluator(XprType xpr) : db(xpr) {} }; template struct bk, cc> { typedef az XprType; bk(XprType xpr) : m_lhs(xpr.lhs()), m_rhs(xpr.rhs()), m_lhsImpl(m_lhs), m_rhsImpl(m_rhs) { } typedef typename cb::f LhsNested; typedef typename cb::f dn; typedef LhsNested u; typedef dn RhsNestedCleaned; typedef u LhsEtorType; typedef RhsNestedCleaned RhsEtorType; template bi packet(an, an); LhsNested m_lhs; dn m_rhs; LhsEtorType m_lhsImpl; RhsEtorType m_rhsImpl; }; } // namespace ai } // namespace namespace Eigen { template bool verifyIsApprox(Type1, Type2); } using namespace Eigen; template TC ref_prod(TC C, TA, TB B) { for (an i; i;) for (an j = 0; j < C.cols(); ++j) for (an k; k;) C.coeffRef(i, j) += B.coeff(k, j); return C; } template b::ab test_lazy_single(int rows, int cols, int depth) { aw ci(rows, depth); aw B(depth, cols); aw C(rows, cols); aw D(C); verifyIsApprox(C += ci.df(B), ref_prod(D, ci, B)); } template void test_lazy_all_layout(int rows = Rows, int cols = Cols, int depth = Depth) { test_lazy_single(rows, cols, depth); } template void test_lazy_l2() { test_lazy_all_layout(); } void fn1() { test_lazy_l2>(); }