https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98545

            Bug ID: 98545
           Summary: [11 Regression] ICE in write_expression, at
                    cp/mangle.c:3352
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at debian dot org
  Target Milestone: ---

seen with trunk 20210102, building the sopt package

$ cat serial_vs_parallel_padmm.ii
class Matrix {
public:
  Matrix();
  template <typename OtherDerived> Matrix(OtherDerived);
};
template <class = double> using Vector = Matrix;
class L1TightFrame {
protected:
  template <class T0, class T1> void operator()(T0, double, T1);
};
class L1 : L1TightFrame {
public:
  template <class... T>
  auto tight_frame(T...) -> decltype(operator()(T()...)) {}
};
template <class> class ImagingProximalADMM {
public:
  template <class DERIVED> ImagingProximalADMM(DERIVED);
  L1 l1_proximal() const;
  int operator()() {
    int result, __trans_tmp_10;
    Vector<> out, __trans_tmp_12;
    operator()(out, __trans_tmp_10, __trans_tmp_12);
    return result;
  }
  int operator()(Vector<> &, Vector<> const &, Vector<> const &) const;
  template <class T0, class T1>
  void l1_proximal(T0 out, double gamma, T1 x) const {
    l1_proximal().tight_frame(out, gamma, x);
  }
};
template <class SCALAR>
int ImagingProximalADMM<SCALAR>::operator()(Vector<> &, Vector<> const &,
                                            Vector<> const &) const {
  int result;
  [&](Vector<> out, double gamma, Vector<> x) { l1_proximal(out, gamma, x); };
  return result;
}
Vector<> y = ImagingProximalADMM<double>(y)();

$ g++ -c -O0 -std=gnu++11 serial_vs_parallel_padmm.ii
serial_vs_parallel_padmm.ii: In instantiation of ‘decltype
(((L1*)this)->L1TightFrame::operator()(T()...)) L1::tight_frame(T ...) [with T
= {Matrix, double, Matrix}]’:
serial_vs_parallel_padmm.ii:14:8: internal compiler error: in write_expression,
at cp/mangle.c:3352
   14 |   auto tight_frame(T...) -> decltype(operator()(T()...)) {}
      |        ^~~~~~~~~~~
0x97242d write_expression
        ../../src/gcc/cp/mangle.c:3352
0x190cd14 write_expression
        ../../src/gcc/cp/mangle.c:3449
0x14b393f write_type
        ../../src/gcc/cp/mangle.c:2343
0x14bafb1 write_bare_function_type
        ../../src/gcc/cp/mangle.c:2746
0x12bdcb0 mangle_decl_string
        ../../src/gcc/cp/mangle.c:4001
0x12bcfcc get_mangled_id
        ../../src/gcc/cp/mangle.c:4022
0x12bcfcc mangle_decl(tree_node*)
        ../../src/gcc/cp/mangle.c:4060
0x12b4558 decl_assembler_name(tree_node*)
        ../../src/gcc/tree.c:708
0x12b4558 symtab_node::get_comdat_group_id()
        ../../src/gcc/cgraph.h:253
0x12b4558 analyze_functions
        ../../src/gcc/cgraphunit.c:1185
0x17f0543 symbol_table::finalize_compilation_unit()
        ../../src/gcc/cgraphunit.c:2513
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.

Reply via email to