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

            Bug ID: 125276
           Summary: Defaulting equality operator (==) causes segfault
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matthewlbritt at gmail dot com
  Target Milestone: ---

This was found on GCC 15.1 and verified on GCC 16.1 (both X64).

Godbolt link:  https://godbolt.org/z/6qoGhPq3b

The following code causes a segfault at the constexpr bool operator line:

/// BEGIN CODE

#include <compare>

enum class IpScope
{
    UNIVERSE,
    LINK,
    UNKNOWN
};

constexpr bool operator==(IpScope lhs, IpScope rhs) = default;


int main()
{

    return 0;
}

/// END CODE


I don't have access to a setup that can get the preprocessed source (sorry).
Here's the compiler output:


<source>:10:55: internal compiler error: Segmentation fault
   10 | constexpr bool operator==(IpScope lhs, IpScope rhs) = default;
      |                                                       ^~~~~~~
0x226a6a8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x226399b internal_error(char const*, ...)
        ???:0
0xa688b4 cp_type_quals(tree_node const*)
        ???:0
0xa5fb6f cp_build_qualified_type(tree_node*, int, int)
        ???:0
0xa6a5d1 same_type_ignoring_top_level_qualifiers_p(tree_node*, tree_node*)
        ???:0
0x90c5fc defaultable_fn_check(tree_node*)
        ???:0
0x8bd61d cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int,
cp_decomp*)
        ???:0
0x9c751d c_parse_file()
        ???:0
0xaf3a69 c_common_parse_file()
        ???:0
/cefs/38/383ad2f84cbd57a52fd68bbe_consolidated/compilers_c++_x86_gcc_16.1.0/bin/../libexec/gcc/x86_64-linux-gnu/16.1.0/cc1plus
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/38/383ad2f84cbd57a52fd68bbe_consolidated/compilers_c++_x86_gcc_16.1.0/bin/../lib/gcc/x86_64-linux-gnu/16.1.0/
-D_GNU_SOURCE -isystem /opt/compiler-explorer/libs/libuv/v1.38.1/include
-isystem /opt/compiler-explorer/libs/stdexec/trunk/include <source> -quiet
-dumpdir /app/ -dumpbase output.cpp -dumpbase-ext .cpp -masm=intel
-mtune=generic -march=x86-64 -g -O3 -std=c++23 -fdiagnostics-color=always
-fno-verbose-asm -freport-bug -o /app/output.s
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Preprocessed source stored into /tmp/ccEryXdK.out file, please attach this to
your bugreport.
Compiler returned: 1

Reply via email to