public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115190] New: -fmodule-mapper does not accept CRLF files
@ 2024-05-22 14:30 huangqinjin at gmail dot com
  2024-05-22 16:44 ` [Bug c++/115190] " bugzilla.gcc at me dot benboeckel.net
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: huangqinjin at gmail dot com @ 2024-05-22 14:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115190
           Summary: -fmodule-mapper does not accept CRLF files
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: huangqinjin at gmail dot com
  Target Milestone: ---

In MSYS2/UCRT64 shell,install gcc (version 14.1.0),

$ printf '$root .\r\n' > a.modmap
$ g++ -std=c++20 -fmodules-ts -fmodule-mapper=a.modmap -E -o /dev/null -x c++
/dev/null
nul: error: failed reading mapper 'a.modmap'


CMake related issue: https://gitlab.kitware.com/cmake/cmake/-/issues/25974

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

* [Bug c++/115190] -fmodule-mapper does not accept CRLF files
  2024-05-22 14:30 [Bug c++/115190] New: -fmodule-mapper does not accept CRLF files huangqinjin at gmail dot com
@ 2024-05-22 16:44 ` bugzilla.gcc at me dot benboeckel.net
  2024-05-22 17:11 ` peter0x44 at disroot dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bugzilla.gcc at me dot benboeckel.net @ 2024-05-22 16:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Ben Boeckel <bugzilla.gcc at me dot benboeckel.net> ---
My analysis points to the change needing to happen in
1module_resolver::read_tuple_file` in `c++tools/resolver.cc`.

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

* [Bug c++/115190] -fmodule-mapper does not accept CRLF files
  2024-05-22 14:30 [Bug c++/115190] New: -fmodule-mapper does not accept CRLF files huangqinjin at gmail dot com
  2024-05-22 16:44 ` [Bug c++/115190] " bugzilla.gcc at me dot benboeckel.net
@ 2024-05-22 17:11 ` peter0x44 at disroot dot org
  2024-05-23 10:35 ` huangqinjin at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: peter0x44 at disroot dot org @ 2024-05-22 17:11 UTC (permalink / raw)
  To: gcc-bugs

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

Peter Damianov <peter0x44 at disroot dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |peter0x44 at disroot dot org

--- Comment #2 from Peter Damianov <peter0x44 at disroot dot org> ---
I could only reproduce this on MSYS2's gcc packages. On w64devkit, I couldn't
reproduce it. Nor with a gcc 15 I built myself.

I suspect perhaps it has something to do with whether gcc uses mmap or not? But
I'm not certain of this.

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

* [Bug c++/115190] -fmodule-mapper does not accept CRLF files
  2024-05-22 14:30 [Bug c++/115190] New: -fmodule-mapper does not accept CRLF files huangqinjin at gmail dot com
  2024-05-22 16:44 ` [Bug c++/115190] " bugzilla.gcc at me dot benboeckel.net
  2024-05-22 17:11 ` peter0x44 at disroot dot org
@ 2024-05-23 10:35 ` huangqinjin at gmail dot com
  2024-05-23 10:36 ` huangqinjin at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: huangqinjin at gmail dot com @ 2024-05-23 10:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from huangqinjin at gmail dot com ---
(In reply to Peter Damianov from comment #2)
> I could only reproduce this on MSYS2's gcc packages. On w64devkit, I
> couldn't reproduce it. Nor with a gcc 15 I built myself.
> 
Oh yes, I made another test, but the error message is different.

$ printf 'test test.gcm\r\n' > a.modmap
$ echo 'export module test;' > test.cpp
$ g++ -std=c++20 -fmodules-ts -fmodule-mapper=a.modmap -c test.cpp
test.cpp:1:8: error: unknown Compiled Module Interface: no such module
    1 | export module test;
      |        ^~~~~~
test.cpp:1:8: warning: not writing module 'test' due to errors

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

* [Bug c++/115190] -fmodule-mapper does not accept CRLF files
  2024-05-22 14:30 [Bug c++/115190] New: -fmodule-mapper does not accept CRLF files huangqinjin at gmail dot com
                   ` (2 preceding siblings ...)
  2024-05-23 10:35 ` huangqinjin at gmail dot com
@ 2024-05-23 10:36 ` huangqinjin at gmail dot com
  2024-05-23 10:40 ` huangqinjin at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: huangqinjin at gmail dot com @ 2024-05-23 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from huangqinjin at gmail dot com ---
The repro in description shows that MSYS2 gcc read the module mapper early even
it is not used, seems to me it doesn't match the document
https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Module-Mapper.html

> The mapper is connected to or loaded lazily,
> when the first module mapping is required.

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

* [Bug c++/115190] -fmodule-mapper does not accept CRLF files
  2024-05-22 14:30 [Bug c++/115190] New: -fmodule-mapper does not accept CRLF files huangqinjin at gmail dot com
                   ` (3 preceding siblings ...)
  2024-05-23 10:36 ` huangqinjin at gmail dot com
@ 2024-05-23 10:40 ` huangqinjin at gmail dot com
  2024-05-23 11:29 ` bugzilla.gcc at me dot benboeckel.net
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: huangqinjin at gmail dot com @ 2024-05-23 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from huangqinjin at gmail dot com ---
(In reply to huangqinjin from comment #3)
> (In reply to Peter Damianov from comment #2)
> > I could only reproduce this on MSYS2's gcc packages. On w64devkit, I
> > couldn't reproduce it. Nor with a gcc 15 I built myself.
> > 
> Oh yes, I made another test, but the error message is different.
> 
> $ printf 'test test.gcm\r\n' > a.modmap
> $ echo 'export module test;' > test.cpp
> $ g++ -std=c++20 -fmodules-ts -fmodule-mapper=a.modmap -c test.cpp
> test.cpp:1:8: error: unknown Compiled Module Interface: no such module
>     1 | export module test;
>       |        ^~~~~~
> test.cpp:1:8: warning: not writing module 'test' due to errors

The line ending of last line is also required. Personally feel strange.

$ printf 'test test.gcm' > a.modmap
$ echo 'export module test;' > test.cpp
$ g++ -std=c++20 -fmodules-ts -fmodule-mapper=a.modmap -c test.cpp
test.cpp:1:8: error: unknown Compiled Module Interface: no such module
    1 | export module test;
      |        ^~~~~~
test.cpp:1:8: warning: not writing module 'test' due to errors

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

* [Bug c++/115190] -fmodule-mapper does not accept CRLF files
  2024-05-22 14:30 [Bug c++/115190] New: -fmodule-mapper does not accept CRLF files huangqinjin at gmail dot com
                   ` (4 preceding siblings ...)
  2024-05-23 10:40 ` huangqinjin at gmail dot com
@ 2024-05-23 11:29 ` bugzilla.gcc at me dot benboeckel.net
  2024-05-23 19:11 ` reiter.christoph at gmail dot com
  2024-05-24 13:21 ` peter0x44 at disroot dot org
  7 siblings, 0 replies; 9+ messages in thread
From: bugzilla.gcc at me dot benboeckel.net @ 2024-05-23 11:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Ben Boeckel <bugzilla.gcc at me dot benboeckel.net> ---
> The line ending of last line is also required. Personally feel strange.

This is explicitly handled (as a "no, not supported" case):
https://github.com/gcc-mirror/gcc/blob/4efa7ec85a85c6024d0907a0e735ad5df7fca952/c%2B%2Btools/resolver.cc#L143

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

* [Bug c++/115190] -fmodule-mapper does not accept CRLF files
  2024-05-22 14:30 [Bug c++/115190] New: -fmodule-mapper does not accept CRLF files huangqinjin at gmail dot com
                   ` (5 preceding siblings ...)
  2024-05-23 11:29 ` bugzilla.gcc at me dot benboeckel.net
@ 2024-05-23 19:11 ` reiter.christoph at gmail dot com
  2024-05-24 13:21 ` peter0x44 at disroot dot org
  7 siblings, 0 replies; 9+ messages in thread
From: reiter.christoph at gmail dot com @ 2024-05-23 19:11 UTC (permalink / raw)
  To: gcc-bugs

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

Christoph Reiter <reiter.christoph at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reiter.christoph at gmail dot com

--- Comment #7 from Christoph Reiter <reiter.christoph at gmail dot com> ---
If the problem is indeed in read_tuple_file(), then I see one potential cause
there:

The file is opened in text mode and it checks if the read count matches the
size of the actual data read. But in text mode where newline normalization
happens the read part can be smaller if there are CRLF in there that got
converted to LF:

https://github.com/gcc-mirror/gcc/blob/0b3b6a8df77b0ae15078402ea5fb933d6fccd585/c%2B%2Btools/resolver.cc#L129-L130

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

* [Bug c++/115190] -fmodule-mapper does not accept CRLF files
  2024-05-22 14:30 [Bug c++/115190] New: -fmodule-mapper does not accept CRLF files huangqinjin at gmail dot com
                   ` (6 preceding siblings ...)
  2024-05-23 19:11 ` reiter.christoph at gmail dot com
@ 2024-05-24 13:21 ` peter0x44 at disroot dot org
  7 siblings, 0 replies; 9+ messages in thread
From: peter0x44 at disroot dot org @ 2024-05-24 13:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Peter Damianov <peter0x44 at disroot dot org> ---
I have been totally unable to reproduce this outside of MSYS2, with any
compilers I built myself. The "MSYS2 MSYS" shell also doesn't have this
problem.

I can't explain why. I tried investigating, but didn't have success.

Peter@DESKTOP-1SHN9FA UCRT64 ~
$  g++ -std=c++20 -fmodules-ts -fmodule-mapper=a.modmap -E -o /dev/null -x c++
/dev/null
nul: error: failed reading mapper 'a.modmap'

Peter@DESKTOP-1SHN9FA UCRT64 ~
$ /c/Users/Peter/3D\ Objects/mydevkit/bin/g++ -B /c/Users/Peter/3D\
Objects/mydevkit/bin/  -std=c++20 -fmodules-ts -fmodule-mapper=a.modmap -E -o
/dev/null -x c++ /dev/null

Peter@DESKTOP-1SHN9FA UCRT64 ~
$ g++ -B /c/Users/Peter/3D\ Objects/mydevkit/bin/  -std=c++20 -fmodules-ts
-fmodule-mapper=a.modmap -E -o /dev/null -x c++ /dev/null
nul: error: failed reading mapper 'a.modmap'

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

end of thread, other threads:[~2024-05-24 13:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-22 14:30 [Bug c++/115190] New: -fmodule-mapper does not accept CRLF files huangqinjin at gmail dot com
2024-05-22 16:44 ` [Bug c++/115190] " bugzilla.gcc at me dot benboeckel.net
2024-05-22 17:11 ` peter0x44 at disroot dot org
2024-05-23 10:35 ` huangqinjin at gmail dot com
2024-05-23 10:36 ` huangqinjin at gmail dot com
2024-05-23 10:40 ` huangqinjin at gmail dot com
2024-05-23 11:29 ` bugzilla.gcc at me dot benboeckel.net
2024-05-23 19:11 ` reiter.christoph at gmail dot com
2024-05-24 13:21 ` peter0x44 at disroot dot org

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).