public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "m.cencora at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/115446] New: [15 Regression] Segfault when exporting operator new
Date: Tue, 11 Jun 2024 21:32:45 +0000	[thread overview]
Message-ID: <bug-115446-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 115446
           Summary: [15 Regression] Segfault when exporting operator new
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m.cencora at gmail dot com
  Target Milestone: ---

$ cat op_new.cpp
module;

void* operator new(unsigned long, void*);

namespace std
{
template<typename _Tp>
auto construct_at(_Tp*) -> decltype(::new((void*)0) _Tp())
{
    return new _Tp();
}

void use(int*p)
{
    construct_at(p);
}
}

export module std;

export
{
using ::operator new;
}

$ g++ -Wno-global-module -fmodules-ts -std=c++2b -c op_new.cpp

'
Segmentation fault
    9 | auto construct_at(_Tp*) -> decltype(::new((void*)0) _Tp())
      |                                     ^~~~~~~~~~~~~~~~~~~~~
0x26c45cc internal_error(char const*, ...)
        ???:0
0xc06a7a lookup_qualified_name(tree_node*, tree_node*, LOOK_want, bool)
        ???:0
0xa93fde build_operator_new_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node**, tree_node**, tree_node*, tree_node*, tree_node**,
int)
        ???:0
0xb8c6f0 build_new(unsigned int, vec<tree_node*, va_gc, vl_embed>**,
tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int, int)
        ???:0
0xcb2a28 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x26ed6c4 pp_format(pretty_printer*, text_info*, urlifier const*)
        ???:0
0x26f06a5 pp_verbatim(pretty_printer*, char const*, ...)
        ???:0
0x26c2e7a diagnostic_context::report_diagnostic(diagnostic_info*)
        ???:0
0x26c45cc internal_error(char const*, ...)
        ???:0
0x972a48 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0xbf6a6d name_lookup::add_overload(tree_node*)
        ???:0
0xbf6ce4 name_lookup::process_binding(tree_node*, tree_node*)
        ???:0
0xc00ce2 name_lookup::search_namespace(tree_node*)
        ???:0
0xc00de0 name_lookup::search_qualified(tree_node*, bool)
        ???:0
0xc06a70 lookup_qualified_name(tree_node*, tree_node*, LOOK_want, bool)
        ???:0
0xa93fde build_operator_new_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node**, tree_node**, tree_node*, tree_node*, tree_node**,
int)
        ???:0
0xb8c6f0 build_new(unsigned int, vec<tree_node*, va_gc, vl_embed>**,
tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int, int)
        ???:0
0xca6373 instantiate_decl(tree_node*, bool, bool)
        ???:0
0xcd08eb instantiate_pending_templates(int)
        ???:0
0xb690f0 c_parse_final_cleanups()
        ???:0


Works fine on gcc-14.
Reduced from an implementation of "std" module:

module;

#include <string_view>

export module std;

export
{
using ::operator new;
}

             reply	other threads:[~2024-06-11 21:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11 21:32 m.cencora at gmail dot com [this message]
2024-06-11 21:36 ` [Bug c++/115446] " pinskia at gcc dot gnu.org
2024-06-11 21:36 ` pinskia at gcc dot gnu.org
2024-06-16 11:44 ` [Bug c++/115446] [15 Regression] [modules] " nshead 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-115446-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).