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

            Bug ID: 118582
           Summary: [modules] Bad file data when building <thread> as a
                    header module
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nshead at gcc dot gnu.org
            Blocks: 103524
  Target Milestone: ---

On current trunk, the following command:

  g++ -std=c++26 -fmodules -xc++-system-header array format thread

Results in the following:

In module imported at /.../thread:55:1:
/.../format: In function ‘std::basic_ostream<_CharT, _Traits>&
std::operator<<(basic_ostream<_CharT, _Traits>&, thread::id)’:
/.../format: error: failed to read compiled module cluster 1154: Bad file data
[-Wtemplate-body]
/.../format: note: compiled module file is ‘gcm.cache/./.../format.gcm’
/.../format: error: failed to read compiled module cluster 1914: Bad file data
[-Wtemplate-body]
/.../format: error: failed to read compiled module cluster 1936: Bad file data
[-Wtemplate-body]
/.../thread:113:53: fatal error: failed to load pendings for
‘std::__conditional_t’
  113 |                           thread::native_handle_type>;
      |                                                     ^
compilation terminated.

A similar error occurs with the addition of -fno-module-lazy:

In module imported at /.../thread:55:1:
/.../format: error: failed to read compiled module cluster 1154: Bad file data
/.../format: note: compiled module file is ‘gcm.cache/./.../format.gcm’
/.../thread: In destructor ‘std::__codecvt_abstract_base<_InternT, _ExternT,
_StateT>::~__codecvt_abstract_base() [with _InternT = char16_t; _ExternT =
char; _StateT = __mbstate_t]’:
/.../thread:55:76: fatal error: failed to load pendings for
‘std::__codecvt_abstract_base’
   55 | # include <format>
      |                 

It appears that the module CMI that's been built has been corrupted in some
way.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
[Bug 103524] [meta-bug] modules issue

Reply via email to