public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98944] New: [modules] Failed to read compiled module with a non-exported partition.
@ 2021-02-02 20:38 iains at gcc dot gnu.org
2021-02-09 6:49 ` [Bug c++/98944] " StevenSun2021 at hotmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: iains at gcc dot gnu.org @ 2021-02-02 20:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98944
Bug ID: 98944
Summary: [modules] Failed to read compiled module with a
non-exported partition.
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: iains at gcc dot gnu.org
Target Milestone: ---
Example 1 from the std:
tu1:
export module A;
export import :Foo;
export int baz();
tu2:
export module A:Foo;
import :Internals;
export int foo() { return 2 * (bar() + 1); }
tu3:
module A:Internals;
int bar();
tu4:
module A;
import :Internals;
int bar() { return baz() - 10; }
int baz() { return 30; }
====
g++ -std=c++20 -fmodules-ts /source/test/module/mu-tu-3.cxx -S
g++ -std=c++20 -fmodules-ts /source/test/module/mu-tu-2.cxx -S
g++ -std=c++20 -fmodules-ts /source/test/module/mu-tu-1.cxx -S
ls gcm.cache/
A-Foo.gcm A-Internals.gcm A.gcm
g++ -std=c++20 -fmodules-ts /source/test/module/mu-tu-4.cxx -S
A: error: failed to read compiled module: Bad file data
A: note: compiled module file is ‘gcm.cache/A.gcm’
...
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/98944] [modules] Failed to read compiled module with a non-exported partition.
2021-02-02 20:38 [Bug c++/98944] New: [modules] Failed to read compiled module with a non-exported partition iains at gcc dot gnu.org
@ 2021-02-09 6:49 ` StevenSun2021 at hotmail dot com
2021-02-09 13:56 ` nathan at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: StevenSun2021 at hotmail dot com @ 2021-02-09 6:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98944
Steven Sun <StevenSun2021 at hotmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |StevenSun2021 at hotmail dot com
--- Comment #1 from Steven Sun <StevenSun2021 at hotmail dot com> ---
I met the same problem.
-------------------------------------------------------------------------
Three days ago, I pull from the repository and then compile the gnu c++
compiler in the devel/c++-modules branch.
system: ubuntu-20.04 x86_64
configured with: --disable-multilib
I took the same exaple as you, which is in the final working draft n4861
[modules.unit].
I think the compile order should be tu3 tu2 tu1 tu4, because the compiler tells
me I cannot import before build. So I compile it as
g++ -fmodules-ts -std=c++20 -c 3.cc -o 3.o
g++ -fmodules-ts -std=c++20 -c 2.cc -o 2.o
g++ -fmodules-ts -std=c++20 -c 1.cc -o 1.o
g++ -fmodules-ts -std=c++20 -c 4.cc -o 4.o
The compiling for 4.cc got an error
------------------------------------------------------
In module imported at 4.cc:1:1:
A: error: failed to read compiled module: Bad file data
A: note: compiled module file is ‘gcm.cache/A.gcm’
A: fatal error: returning to the gate for a mechanical issue
compilation terminated.
------------------------------------------------------
Then I took a peek into the gcm.cache/A.gcm, using readelf. Found that there's
already a section header named bar.
So I removed the line `import :Internals;` in 4.cc and it compiles.
Anyway, I don't know if that is a bug. Maybe the standard is different from the
final working draft. I am not sure.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/98944] [modules] Failed to read compiled module with a non-exported partition.
2021-02-02 20:38 [Bug c++/98944] New: [modules] Failed to read compiled module with a non-exported partition iains at gcc dot gnu.org
2021-02-09 6:49 ` [Bug c++/98944] " StevenSun2021 at hotmail dot com
@ 2021-02-09 13:56 ` nathan at gcc dot gnu.org
2021-02-09 16:17 ` cvs-commit at gcc dot gnu.org
2021-02-09 16:17 ` nathan at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-02-09 13:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98944
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |nathan at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Last reconfirmed|2021-02-02 00:00:00 |2021-02-09
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/98944] [modules] Failed to read compiled module with a non-exported partition.
2021-02-02 20:38 [Bug c++/98944] New: [modules] Failed to read compiled module with a non-exported partition iains at gcc dot gnu.org
2021-02-09 6:49 ` [Bug c++/98944] " StevenSun2021 at hotmail dot com
2021-02-09 13:56 ` nathan at gcc dot gnu.org
@ 2021-02-09 16:17 ` cvs-commit at gcc dot gnu.org
2021-02-09 16:17 ` nathan at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-09 16:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98944
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathan Sidwell <nathan@gcc.gnu.org>:
https://gcc.gnu.org/g:92941cea2f05a8cf79fc71aa39fa948dcfb82d7a
commit r11-7150-g92941cea2f05a8cf79fc71aa39fa948dcfb82d7a
Author: Nathan Sidwell <nathan@acm.org>
Date: Tue Feb 9 08:11:58 2021 -0800
c++: Fix indirect partitions [PR 98944]
The most recent reimplementation of module loading initialization
changed the behaviour of setting an import's location, and broke some
partition handling.
PR c++/98944
gcc/cp/
* module.cc (module_state::is_rooted): Rename to ...
(module_state::has_location): ... here. Adjust callers.
(module_state::read_partitions): Adjust validity check.
Don't overwrite a known location.
gcc/testsuite/
* g++.dg/modules/pr98944_a.C: New.
* g++.dg/modules/pr98944_b.C: New.
* g++.dg/modules/pr98944_c.C: New.
* g++.dg/modules/pr98944_d.C: New.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/98944] [modules] Failed to read compiled module with a non-exported partition.
2021-02-02 20:38 [Bug c++/98944] New: [modules] Failed to read compiled module with a non-exported partition iains at gcc dot gnu.org
` (2 preceding siblings ...)
2021-02-09 16:17 ` cvs-commit at gcc dot gnu.org
@ 2021-02-09 16:17 ` nathan at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-02-09 16:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98944
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #3 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
92941cea2f0 2021-02-09 | c++: Fix indirect partitions [PR 98944]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-02-09 16:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02 20:38 [Bug c++/98944] New: [modules] Failed to read compiled module with a non-exported partition iains at gcc dot gnu.org
2021-02-09 6:49 ` [Bug c++/98944] " StevenSun2021 at hotmail dot com
2021-02-09 13:56 ` nathan at gcc dot gnu.org
2021-02-09 16:17 ` cvs-commit at gcc dot gnu.org
2021-02-09 16:17 ` nathan at gcc dot gnu.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).