This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ RFC / Patch] Another recursive template instantiation issue (c++/51488, etc)


Hi,

besides the issue discussed a bit some time ago, we have got in Bugzilla a number of other issues, all essentially dups of each other (modulo irrelevant details, AFAICS)

    c++/51488
    c++/53618
    c++/58059
    c++/56163 (this is two bugs, the second one is dup of c++/55843)

In these the infinite recursion involves instantiate_class_template_1 but via most_specialized_class (c++/51488 has a backtrace) thus at the beginning of the function, and we don't catch it.

To explain *in practice* what I mean, the attached patchlet p avoid all these crashes (+ passes the testsuite as-is modulo an XPASS for line 8 of template/recurse.C).

Unfortunately, at the time I didn't follow in detail the implementation of the push_tinst_level mechanism, now I see it used many times with little variations, thus I definitely need further guidance (my patchlet is loosely inspired by the use in maybe_instantiate_noexcept). In particular, I fear memory leaks or mismanagement (I see a ggc_free (tinst); in instantiate_alias_template which I don't fully understand).

Also, I wonder if we could provide more detailed information...

Thanks in advance!
Paolo.

///////////////////////////

Attachment: p
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]