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
* [Bug c++/98362] bad file data on Windows for C++ 20 module
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 ` nathan at gcc dot gnu.org
2020-12-18 13:38 ` nathan at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-12-18 12:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98362
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2020-12-18
Status|UNCONFIRMED |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |nathan at gcc dot gnu.org
--- Comment #1 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
ah, I didn't know the binary/text distinction descended below the FILE level on
windows
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/98362] bad file data on Windows for C++ 20 module
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
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-12-18 13:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98362
--- Comment #2 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Created attachment 49797
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49797&action=edit
test patch
care to try this?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/98362] bad file data on Windows for C++ 20 module
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
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: unlvsur at live dot com @ 2020-12-18 13:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98362
--- Comment #3 from cqwrteur <unlvsur at live dot com> ---
(In reply to Nathan Sidwell from comment #2)
> Created attachment 49797 [details]
> test patch
>
> care to try this?
Sure
BTW. Windows do provide a flag O_NOINHERIT which matches O_CLOSEXEC.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/98362] bad file data on Windows for C++ 20 module
2020-12-17 22:57 [Bug c++/98362] New: bad file data on Windows for C++ 20 module unlvsur at live dot com
` (2 preceding siblings ...)
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
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: unlvsur at live dot com @ 2020-12-18 13:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98362
--- Comment #4 from cqwrteur <unlvsur at live dot com> ---
(In reply to Nathan Sidwell from comment #2)
> Created attachment 49797 [details]
> test patch
>
> care to try this?
I will modify your patch and try to support O_CLOSEXEC on Windows
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/98362] bad file data on Windows for C++ 20 module
2020-12-17 22:57 [Bug c++/98362] New: bad file data on Windows for C++ 20 module unlvsur at live dot com
` (3 preceding siblings ...)
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
6 siblings, 0 replies; 8+ messages in thread
From: unlvsur at live dot com @ 2020-12-18 14:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98362
--- Comment #5 from cqwrteur <unlvsur at live dot com> ---
Created attachment 49798
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49798&action=edit
Compilation Working patch. Tested on both x86_64-linux-gnu and
mingw-w64-x86_64-windows10
This also adds the support for O_CLOEXEC on Windows with the O_NOINHERIT flag.
No longer uses HOST_HAS_O_CLOEXEC macro generated by the autotool. Directly
checking O_CLOEXEC macro on that platform.
There is a new bug for libstdc++ before I could test whether module works on
windows, but this patch does not break compilation.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/98362] bad file data on Windows for C++ 20 module
2020-12-17 22:57 [Bug c++/98362] New: bad file data on Windows for C++ 20 module unlvsur at live dot com
` (4 preceding siblings ...)
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
6 siblings, 0 replies; 8+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-12-18 15:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98362
--- Comment #6 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
* 785b49434d2 2020-12-18 | c++: Fix windows binary files [PR 98362]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/98362] bad file data on Windows for C++ 20 module
2020-12-17 22:57 [Bug c++/98362] New: bad file data on Windows for C++ 20 module unlvsur at live dot com
` (5 preceding siblings ...)
2020-12-18 15:39 ` nathan at gcc dot gnu.org
@ 2020-12-19 2:00 ` unlvsur at live dot com
6 siblings, 0 replies; 8+ messages in thread
From: unlvsur at live dot com @ 2020-12-19 2:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98362
cqwrteur <unlvsur at live dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #7 from cqwrteur <unlvsur at live dot com> ---
(In reply to Nathan Sidwell from comment #6)
> * 785b49434d2 2020-12-18 | c++: Fix windows binary files [PR 98362]
Works on Windows Confirm. Thank you!
^ 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).