Package: libstdc++-14-dev Version: 14-20240330-1 Severity: normal Tags: upstream
Dear Maintainer, * What led up to the situation? Importing multiple module-compiled system headers using compilation commands like g++ --std=c++23 -Wall -fmodules-ts -x c++-system-header vector and importing those compiled system headers in a program results in an internal compiler error when 'import <memory>;' is also used. * What exactly did you do (or not do) that was effective (or ineffective)? First the system headers where compiled using the abovementioned commad. Then the compiled headers (like vector.gcm) were made available via the program's gcm.cache subdirectory. The program was compiled using g++ --std=c++23 -Wall -fmodules-ts -freport-bug -c main.cc The following program compiled OK: import <string>; import <vector>; //import <memory>; int main() { std::vector<int> vect; } But when activating 'import <memory>;' compilation fails and the compiler reports an internal compiler error. There's no internal compiler error when only vector and memory are imported (i.e., only using these import statements): import <vector>; import <memory>; but once 'import <string>;' is also specified the internal compiler error results. * What was the outcome of this action? The compiler, when importing string, vector, and memory, produced the following output (shown between the ======== lines): =================================================================== In file included from /usr/include/c++/14/format:49, from /usr/include/c++/14/ostream:43, from /usr/include/c++/14/bits/unique_ptr.h:43, from /usr/include/c++/14/memory:78, of module /usr/include/c++/14/memory, imported at main.cc:7: /usr/include/c++/14/span: In instantiation of ‘constexpr std::span<_Type, 18446744073709551615> std::span<_Type, _Extent>::subspan(size_type, size_type) const [with _Type = wchar_t; long unsigned int _Extent = 18446744073709551615; size_type = long unsigned int]’: /usr/include/c++/14/format:2671:31: required from ‘constexpr std::span<_Type, 18446744073709551615> std::__format::_Sink<_CharT>::_M_unused() const [with _CharT = wchar_t]’ 2671 | { return _M_span.subspan(_M_next - _M_span.begin()); } | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/format:2735:13: required from ‘std::__format::_Sink<_CharT>::_Reservation std::__format::_Sink<_CharT>::_M_reserve(std::size_t) [with _CharT = wchar_t; std::size_t = long unsigned int]’ 2735 | if (__n <= _M_unused().size()) | ^~~~~~~~~ /usr/include/c++/14/format:2733:7: required from here 2733 | _M_reserve(size_t __n) | ^~~~~~~~~~ /usr/include/c++/14/span:439:49: internal compiler error: in insert, at cp/module.cc:4929 439 | return {this->data() + __offset, __count}; | ^ 0x76cb4f trees_in::insert(tree_node*) ../../src/gcc/cp/module.cc:4929 0x76cb4f trees_in::insert(tree_node*) ../../src/gcc/cp/module.cc:4927 0x100da8a trees_in::add_indirect_tpl_parms(tree_node*) ../../src/gcc/cp/module.cc:7353 0x100dbf0 trees_in::add_indirects(tree_node*) ../../src/gcc/cp/module.cc:7419 0x102c17f trees_in::tree_node(bool) ../../src/gcc/cp/module.cc:9964 0x1032d99 module_state::read_cluster(unsigned int) ../../src/gcc/cp/module.cc:14977 0x103364d module_state::load_section(unsigned int, binding_slot*) ../../src/gcc/cp/module.cc:18477 0x103370e module_state::lazy_load(unsigned int, binding_slot*) ../../src/gcc/cp/module.cc:19161 0x1036afc lazy_load_pendings(tree_node*) ../../src/gcc/cp/module.cc:19262 0x10f8887 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*, int, int) ../../src/gcc/cp/pt.cc:10030 0x10f9fdf tsubst_aggr_type_1 ../../src/gcc/cp/pt.cc:14171 0x10fb182 tsubst(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/pt.cc:16783 0x10fa5eb tsubst(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/pt.cc:16231 0x10ffe94 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/pt.cc:13891 0xf330c2 normalize_concept_check ../../src/gcc/cp/constraint.cc:761 0xf330c2 normalize_atom ../../src/gcc/cp/constraint.cc:816 0xf330c2 normalize_expression ../../src/gcc/cp/constraint.cc:886 0xf33800 normalize_logical_operation ../../src/gcc/cp/constraint.cc:693 0xf337a5 normalize_logical_operation ../../src/gcc/cp/constraint.cc:692 0xf33709 normalize_concept_check ../../src/gcc/cp/constraint.cc:795 Please submit a full bug report, with preprocessed source. Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-14/README.Bugs> for instructions. =================================================================== * What outcome did you expect instead? I expected that the program would also successfully compile when <vector>, <string> and <memory> were imported. As a more extensive test I also compiled the program importing <limits>, <deque>, <string>, and <vector>: this variant also compiles OK. Interestingly when importing all these system headers, including <string> the internal compiler error was again observed. It looks like the combination of importing <string> and <memory> causes the error. But on the other hand: the following program, merely defining a std::string and importing <string> and <memory>, successfully compiles: import <string>; import <memory>; int main() { std::string str; } -- System Information: Debian Release: trixie/sid APT prefers testing APT policy: (500, 'testing'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 6.7.12-amd64 (SMP w/4 CPU threads; PREEMPT) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages libstdc++-14-dev depends on: ii gcc-14-base 14-20240330-1 ii libc6-dev 2.38-13 ii libgcc-14-dev 14-20240330-1 ii libstdc++6 14-20240330-1 libstdc++-14-dev recommends no packages. Versions of packages libstdc++-14-dev suggests: pn libstdc++-14-doc <none> -- no debconf information