https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118920
Bug ID: 118920
Summary: ICE when importing memory and filesystem and a
module-compiled system header importing memory
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: f.b.brokken at rug dot nl
Target Milestone: ---
Created attachment 60521
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60521&action=edit
The compiler's output resulting in the internal compiler error
The bug I report somewhat resembles #104433, but it looks different, hence the
report. The code snippets below were reduced to their bare essentials to make
the bug stand out clearly.
First, the directory /usr/include/demo was defined, and in there the header
'demo':
#ifndef INCLUDED_DEMO_HDR_
#define INCLUDED_DEMO_HDR_
#include <memory>
#endif
Then in /usr/include demo/demo was module compiled using
g++ --std=c++26 -fmodules-ts -x c++-system-header demo/demo
and demo.gcm was moved from gcm.cache/usr/include/demo to ./
/usr/include/demo now contains 'demo' and 'demo.gcm'
Likewise, in /usr/include/c++/15 the headers 'memory' and 'filesystem' were
module compiled and installed in /usr/include/c++/15
Next, in a working directory (say: /tmp/demo) the directory ./gcm.cache/ was
defined and in there a softlink to /usr (gcm.cache/usr -> /usr)
and 'modbase.cc' was written in /tmp/demo:
export module Base;
export import <memory>;
export
{
class Base
{
std::shared_ptr<double> d_out;
public:
void resetValue(double value);
};
}
It was compiled using g++ -c --std=c++26 -fmodules-ts modbase.cc producing the
file gcm.cache/Base.gcm
Then the file bug.cc was written in /tmp/demo:
module Base;
import <filesystem>;
import <demo/demo>;
void Base::resetValue(double value)
{
d_out.reset(new double(value));
}
and compiled using the command
g++ -c --std=c++26 -freport-bug -fmodules-ts bug.cc
resulting in an internal compiler error:
/usr/include/c++/15/format:1368:15: internal compiler error: canonical types
differ for identical types ...
(the full report is attached)
When 'import <filesystem>;' is removed from bug.cc no errors are reported.
Likewise, when it is kept, but 'import <memory>;' replaces 'import
<demo/demo>;' there's also no compiler error: in both cases compilation
successfully completes.
As an aside: the other day I upgraded g++-14 to g++15.0.1 on my computer
(running Debian's testing (trixie) distribution) and I'm impressed by the
module-related improvements that were realized. Chapeau! In fact yesterday I
could completely convert a non-trivial program to a version merely using
modules. Nice, and this report doesn't reduce -in no way- the confidence I have
in your work.
Please contact me if you need additional information.
Thanks!!