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

--- Comment #17 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathan Sidwell <nat...@gcc.gnu.org>:

https://gcc.gnu.org/g:584731ecedf09c2c067913c4af9ed0a30cf19e8d

commit r11-7950-g584731ecedf09c2c067913c4af9ed0a30cf19e8d
Author: Nathan Sidwell <nat...@acm.org>
Date:   Thu Apr 1 05:25:53 2021 -0700

    c++: inter-cluster import order [PR 99283]

    I finally managed to reduce the testcase without hitting other bugs.
    This problem is caused by discovering a duplicate in the middle of
    reading in the entity in question.  I had thougt the import seeding at
    the beginning of a cluster prevented that, but it is insufficient.
    Specifically an earlier cluster in the same module can cause the
    import of a duplicate.  Although clusters within a module are
    well-ordered, there is no ordering between clusters of one module and
    clusters of another module.  And thus we can get duplicate declaration
    loops.  This prevents the problem by also seeding references to
    earlier clusters in the same module.  As the FIXME notes, it is
    sufficient to reference a single entity in any particular earlier
    cluster, plus, we also could determine the implicit dependencies and
    prune that seeding even further.  I do not do that -- it decrease the
    loading that will happen, but would reduce the serialization size.  As
    ever, let's get correctness first.

            PR c++/99283
            gcc/cp/
            * module.cc (trees_out::decl_node): Adjust importedness reference
            assert.
            (module_state::intercluster_seed): New.  Seed both imports and
            inter-cluster references.  Broken out of ...
            (module_state::write_cluster): ... here.  Call it.
            gcc/testsuite/
            * g++.dg/modules/pr99283-6.h: New.
            * g++.dg/modules/pr99283-6_a.H: New.
            * g++.dg/modules/pr99283-6_b.H: New.
            * g++.dg/modules/pr99283-6_c.C: New.
            * g++.dg/modules/hdr-init-1_c.C: Adjust scan.
            * g++.dg/modules/indirect-3_c.C: Adjust scan.
            * g++.dg/modules/indirect-4_c.C: Adjust scan.
            * g++.dg/modules/lambda-3_b.C: Adjust scan.
            * g++.dg/modules/late-ret-3_c.C: Adjust scan.
            * g++.dg/modules/pr99425-1_b.H: Adjust scan.
            * g++.dg/modules/pr99425-1_c.C: Adjust scan.

Reply via email to