https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89692
--- Comment #6 from Jan Hubicka <hubicka at ucw dot cz> --- > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89692 > > --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > There is: > fld_worklist_push (TYPE_MAIN_VARIANT (t), fld); > /* Do not walk TYPE_NEXT_VARIANT. We do not stream it and thus > do not and want not to reach unused variants this way. */ > I believe this is the bug, we do want to walk it even if it is not streamed. > Walking it should be just more work during fld, true, but I don't see what > harm > it would do. Honza? > > --- gcc/tree.c.jj 2019-03-19 17:10:04.248125906 +0100 > +++ gcc/tree.c 2019-03-20 11:50:19.166755015 +0100 > @@ -5875,8 +5875,7 @@ find_decls_types_r (tree *tp, int *ws, v > if (!RECORD_OR_UNION_TYPE_P (t)) > fld_worklist_push (TYPE_MAX_VALUE_RAW (t), fld); > fld_worklist_push (TYPE_MAIN_VARIANT (t), fld); > - /* Do not walk TYPE_NEXT_VARIANT. We do not stream it and thus > - do not and want not to reach unused variants this way. */ > + fld_worklist_push (TYPE_NEXT_VARIANT (t), fld); > if (TYPE_CONTEXT (t)) > { > tree ctx = TYPE_CONTEXT (t); > > certainly fixes the ICE. Yes, I tried this some time ago but it ICEs with chekcing enabled because C++ FE produces types that do not pass verify_type and puts them into variant lists. Also Richi did not like reaching more types than necessary. For this reason I went for a variant of patch that prunes the lists but Richi did not like it either. I will check if I still reproduce the ICE. https://patchwork.ozlabs.org/patch/967595/ I do not fully follow Richi's concern about duplicate types: the types not visible by fld should be invisitable to middle-end and thus not used later. Honza