public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tim152 at tgf dot pw" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/103844] New: [modules] ICE when exporting shared_ptr alias
Date: Mon, 27 Dec 2021 09:42:22 +0000	[thread overview]
Message-ID: <bug-103844-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2021-12-27  9:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-27  9:42 tim152 at tgf dot pw [this message]
2024-03-06 22:04 ` [Bug c++/103844] " ppalka at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103844-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).