public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103844] New: [modules] ICE when exporting shared_ptr alias
@ 2021-12-27  9:42 tim152 at tgf dot pw
  2024-03-06 22:04 ` [Bug c++/103844] " ppalka at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: tim152 at tgf dot pw @ 2021-12-27  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103844
           Summary: [modules] ICE when exporting shared_ptr alias
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tim152 at tgf dot pw
  Target Milestone: ---

Created attachment 52066
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52066&action=edit
preprocessed module source

Exporting an alias to shared_ptr causes a compiler segfault on usage.
This also breaks with unique_ptr, but works for other types.

mod.cpp:
module;
#include <memory>
export module tree;
export template<typename T>
using p = std::shared_ptr<T>;

(mod.ii attached)

main.cpp:
import tree;
int main() {
  p<long> t;
}

% gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20211226 (experimental) (GCC)
```

Compiled using
% g++ mod.cpp -c -fmodules-ts -std=c++20 -Wall -Wextra
(no output)

% g++ main.cpp -c -fmodules-ts -std=c++20 -Wall -Wextra
In file included from /usr/local/include/c++/12.0.0/bits/shared_ptr.h:53,
                 from /usr/local/include/c++/12.0.0/memory:77,
                 from mod.cpp:2,
of module tree, imported at main.cpp:1:
/usr/local/include/c++/12.0.0/bits/shared_ptr_base.h: In instantiation of
‘class std::__shared_ptr@tree<long int, __gnu_cxx::_S_atomic>’:
/usr/local/include/c++/12.0.0/bits/shared_ptr.h:124:11:   required from ‘class
std::shared_ptr@tree<long int>’
main.cpp:4:11:   required from here
Segmentation fault
 1442 |         struct __has_esft_base
      |                ^~~~~~~~~~~~~~~
0x1180abf crash_signal
        ../../gcc/toplev.c:322
0xa88d16 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc/tree.h:3563
0xa88d16 get_originating_module_decl(tree_node*)
        ../../gcc/cp/module.cc:18339
0xa88e97 get_originating_module(tree_node*, bool)
        ../../gcc/cp/module.cc:18378
0xa301ef dump_module_suffix
        ../../gcc/cp/error.c:205
0xa301ef dump_module_suffix
        ../../gcc/cp/error.c:185
0xa30593 dump_aggr_type
        ../../gcc/cp/error.c:846
0xa3a352 decl_to_string
        ../../gcc/cp/error.c:3225
0xa3a352 cp_printer
        ../../gcc/cp/error.c:4396
0x20a99fa pp_format(pretty_printer*, text_info*)
        ../../gcc/pretty-print.c:1475
0x208be8b diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        ../../gcc/diagnostic.c:1346
0x208c3b8 diagnostic_impl
        ../../gcc/diagnostic.c:1508
0x208ccfa error_at(unsigned int, char const*, ...)
        ../../gcc/diagnostic.c:1831
0xa01d80 duplicate_decls(tree_node*, tree_node*, bool, bool)
        ../../gcc/cp/decl.c:1795
0xabb1ca check_module_override
        ../../gcc/cp/name-lookup.c:3586
0xabb1ca pushdecl(tree_node*, bool)
        ../../gcc/cp/name-lookup.c:3724
0xabd54c do_pushdecl_with_scope
        ../../gcc/cp/name-lookup.c:4767
0xabd77a pushdecl_namespace_level(tree_node*, bool)
        ../../gcc/cp/name-lookup.c:6088
0xb6e95f tsubst_friend_class
        ../../gcc/cp/pt.c:11444
0xb6e95f instantiate_class_template_1
        ../../gcc/cp/pt.c:12171
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug c++/103844] [modules] ICE when exporting shared_ptr alias
  2021-12-27  9:42 [Bug c++/103844] New: [modules] ICE when exporting shared_ptr alias tim152 at tgf dot pw
@ 2024-03-06 22:04 ` ppalka at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-03-06 22:04 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
dup

*** This bug has been marked as a duplicate of bug 105320 ***

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

end of thread, other threads:[~2024-03-06 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-27  9:42 [Bug c++/103844] New: [modules] ICE when exporting shared_ptr alias tim152 at tgf dot pw
2024-03-06 22:04 ` [Bug c++/103844] " ppalka 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).