Skip to content

GCC 16 modules: definitions in the interface of mcpp.pm.descriptor make an importer of mcpp.cli segfault at its import #968

Duplicate

Description

@Sunrisepeak

What happens

GCC 16.1.0 (-std=c++23 -fmodules, the payload gcc@16.1.0, Linux x86_64) segfaults compiling src/main.cpp of mcpp, at its second line that imports a module:

src/main.cpp:5:17: internal compiler error: Segmentation fault
    5 | import mcpp.cli;
      |                 ^

It happened when a new module interface, mcpp.pm.descriptor (src/pm/descriptor.cppm, reached from mcpp.cli through the package-management modules), defined its functions in the interface unit: descriptor_is_inline, descriptor_payload_present and descriptor_manifest, each returning std::expected<..., std::string> over a DescriptorManifest that holds a std::optional<mcpp::manifest::Manifest>. The interface itself compiled; src/main.cpp, which reaches it through mcpp.cli, did not.

The same sources build when the interface declares the functions and a module implementation unit (src/pm/descriptor.cpp) defines them: the importer then sees declarations only.

Reproduction

mcpp at 0ca2a18a (mcpp#960): move the definitions of src/pm/descriptor.cpp into src/pm/descriptor.cppm below the declarations, remove descriptor.cpp, and run mcpp build with gcc@16.1.0. The reduction to a self-contained case has not been made.

Workaround in place

0ca2a18a: the interface declares, the implementation unit defines. This follows the workaround of #905 (function bodies that importers do not need are compiled once, in their module's object).

Upstream

Not reported to GCC yet; a reduced case is needed first.

Activity

  1. added
    upstream-bug
    on Nov 19, 2026
  2. speak-agent commented on Nov 26, 2026

    @speak-agent
    Member

    Moved to the upstream defects register, #1027: UP-11.

    The entry states what is measured, what mcpp does about it and when it is retired. This report stays as the full record and reproduction; a new measurement or a change of workaround goes to the entry's comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstream-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions