https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66394
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test case:
$ cat color.ii
template <typename Cvt> void CvtColorLoop(int, int, const Cvt &);
enum { R2Y, G2Y, B2Y };
struct RGB2Gray {
RGB2Gray(int, int, int coeffs) {
const int coeffs0[]{G2Y, B2Y};
coeffs = coeffs0;
tab[2] = coeffs;
}
int tab[];
};
cvtColor_bidx() {
int src, dst;
CvtColorLoop(src, dst, RGB2Gray(0, cvtColor_bidx, 0));
}
$ g++ -fmerge-all-constants -flto -c color.ii -c -fpermissive
0xa8395f crash_signal
../../gcc/toplev.c:380
0x985325 compute_ltrans_boundary(lto_symtab_encoder_d*)
../../gcc/lto-cgraph.c:1024
0x9da94f ipa_write_summaries()
../../gcc/passes.c:2519
0x76c300 ipa_passes
../../gcc/cgraphunit.c:2215
0x76c300 symbol_table::compile()
../../gcc/cgraphunit.c:2311
0x76d8b0 symbol_table::finalize_compilation_unit()
../../gcc/cgraphunit.c:2460
0x5f8cf2 cp_write_global_declarations()
../../gcc/cp/decl2.c:4793