public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98362] New: bad file data on Windows for C++ 20 module
@ 2020-12-17 22:57 unlvsur at live dot com
  2020-12-18 12:48 ` [Bug c++/98362] " nathan at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: unlvsur at live dot com @ 2020-12-17 22:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98362
           Summary: bad file data on Windows for C++ 20 module
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: unlvsur at live dot com
  Target Milestone: ---

I guess the reason is because of CRLF issue. You need to open module file with
_O_BINARY flag. Or msvcrt or ucrt will trigger them as a text stream. I guess
that is the solution

E:\mingw-w64-backup\msys64\home\unlvs\www>g++ -o main hello.cc main.cc -Ofast
-std=c++20 -s -fmodules-ts
In module imported at main.cc:1:1:
hello: error: failed to read compiled module: Bad file data
hello: note: compiled module file is 'gcm.cache/hello.gcm'
hello: fatal error: returning to the gate for a mechanical issue
compilation terminated.


hello.cc

module;
#include<cstdio>
export module hello;
export inline void greeter (char const* cstr) noexcept
{
        std::puts(cstr);
}

main.cc

import hello;
int main (void)
{
        greeter("Hello\n");
}

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-12-19  2:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 22:57 [Bug c++/98362] New: bad file data on Windows for C++ 20 module unlvsur at live dot com
2020-12-18 12:48 ` [Bug c++/98362] " nathan at gcc dot gnu.org
2020-12-18 13:38 ` nathan at gcc dot gnu.org
2020-12-18 13:44 ` unlvsur at live dot com
2020-12-18 13:48 ` unlvsur at live dot com
2020-12-18 14:56 ` unlvsur at live dot com
2020-12-18 15:39 ` nathan at gcc dot gnu.org
2020-12-19  2:00 ` unlvsur at live dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).