public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115446] New: [15 Regression] Segfault when exporting operator new
@ 2024-06-11 21:32 m.cencora at gmail dot com
  2024-06-11 21:36 ` [Bug c++/115446] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: m.cencora at gmail dot com @ 2024-06-11 21:32 UTC (permalink / raw)
  To: gcc-bugs

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;
}

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

* [Bug c++/115446] [15 Regression] Segfault when exporting operator new
  2024-06-11 21:32 [Bug c++/115446] New: [15 Regression] Segfault when exporting operator new m.cencora at gmail dot com
@ 2024-06-11 21:36 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-11 21:36 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |15.0

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

* [Bug c++/115446] [15 Regression] Segfault when exporting operator new
  2024-06-11 21:32 [Bug c++/115446] New: [15 Regression] Segfault when exporting operator new m.cencora at gmail dot com
  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
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-11 21:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
s/unsigned long/decltype(sizeof(0))/

to make the testcase more portable since not all targets use `unsigned long` as
size_t.

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

* [Bug c++/115446] [15 Regression] [modules] Segfault when exporting operator new
  2024-06-11 21:32 [Bug c++/115446] New: [15 Regression] Segfault when exporting operator new m.cencora at gmail dot com
  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 ` nshead at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-06-16 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

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

--- Comment #2 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
This looks to be fixed by r15-1224-g074c1fc7974359.

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

end of thread, other threads:[~2024-06-16 11:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-11 21:32 [Bug c++/115446] New: [15 Regression] Segfault when exporting operator new m.cencora at gmail dot com
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

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).