https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98282
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2020-12-14 --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Reduced testcase that ICEs with -O2 even with current trunk in PRE: template <typename> struct g; template <typename b> struct g<b &> { typedef b c; }; template <typename b> typename g<b>::c &&d(b &&e) { return static_cast<typename g<b>::c &&>(e); } void *operator new(__SIZE_TYPE__, void *f) { return f; } struct h; struct k { using i = h *; }; struct D { k::i j; }; struct p : D { p(p &&) : D() {} }; struct r { using l = int; r(r &&) : ad() {} l *ad; }; struct s { static s m(); }; struct t { template <typename ah> void operator=(ah); }; struct I { template <typename o> void q(o ai) { *ai = aj(); s::m(); } h aj(); }; template <typename...> class as; struct J { int a; char av; }; template <typename...> struct aw : J { void ax(...) {} }; template <typename... ay, typename an, typename... n> struct aw<as<ay...>, an, n...> : aw<as<ay...>, n...> { using az = as<ay...>; using ba = aw<az, n...>; char bb; an &bc() { return *reinterpret_cast<an *>(this); } void ax(az *bd) { if (bb) new (bd) an(d(bc())); ba::ax(bd); } }; template <typename... n> struct as : aw<as<n...>, n...> { as(); as(as &&be) { be.ax(this); } void operator=(as be) { be.ax(this); } }; struct h { as<decltype(nullptr), r, p> bg; }; using bh = t; struct u { bh bj; }; I bk(); template <typename> void bl() { h a; bk().q(&a); } template <typename> void bn(int) { u b; b.bj = bl<int>; } void bp() { bn<int>(0); } /usr/src/gcc/obj/gcc/cc1plus -quiet -O2 pr98282.ii during GIMPLE pass: pre pr98282.ii: In function ‘void bl() [with <template-parameter-1-1> = int]’: pr98282.ii:68:26: internal compiler error: Segmentation fault 68 | template <typename> void bl() { | ^~ 0x17098ba crash_signal ../../gcc/toplev.c:327 0x9dc372 contains_struct_check(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ../../gcc/tree.h:3707 0xa7089b wi::to_wide(tree_node const*) ../../gcc/tree.h:5983 0x19caa55 compute_avail ../../gcc/tree-ssa-pre.c:4214 0x19cb145 execute ../../gcc/tree-ssa-pre.c:4408 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.