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

            Bug ID: 122832
           Summary: internal compiler error: error reporting routines
                    re-entered
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 522024330006 at smail dot nju.edu.cn
  Target Milestone: ---

When I run the following code with -std=c++20 flag, it went crash, and it did
not go crash with the flag -std=c++23.

The details can be found here: https://godbolt.org/z/PchPeqoT4

Program:
```c
#include <vector>
#include <iostream>
#include <cstdio>

template<typename T>
void foo(decltype(auto(T())) x) {
    std::vector<int> v = {1, 2, 4, 8};

    for(int i : v)
        i <<= x;
}

int main() {
    int a = 3;

    foo<decltype(auto(a))>(a);

}
```

The full backtrace is:

bugs/13030.fuzz:8:19: warning: 'auto(x)' only available with '-std=c++23' or
'-std=gnu++23' [-Wc++23-extensions]

internal compiler error: error reporting routines re-entered.
0x5da03aa pedwarn(unsigned long, diagnostic_option_id, char const*, ...)
        /workspace/install/gcc/src/gcc/gcc/diagnostic-global-context.cc:291
0x16f8612 build_functional_cast_1
        /workspace/install/gcc/src/gcc/gcc/cp/typeck2.cc:2512
0x16f8eee build_functional_cast(unsigned long, tree_node*, tree_node*, int)
        /workspace/install/gcc/src/gcc/gcc/cp/typeck2.cc:2613
0x1523522 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        /workspace/install/gcc/src/gcc/gcc/cp/pt.cc:20788
0x1500309 tsubst(tree_node*, tree_node*, int, tree_node*)
        /workspace/install/gcc/src/gcc/gcc/cp/pt.cc:17250
0x115e4e0 dump_template_bindings
        /workspace/install/gcc/src/gcc/gcc/cp/error.cc:597
0x116a318 dump_substitution
        /workspace/install/gcc/src/gcc/gcc/cp/error.cc:1811
0x116d7b2 dump_function_decl
        /workspace/install/gcc/src/gcc/gcc/cp/error.cc:1983
0x1168038 dump_decl
        /workspace/install/gcc/src/gcc/gcc/cp/error.cc:1537
0x117adde decl_to_string
        /workspace/install/gcc/src/gcc/gcc/cp/error.cc:3457
0x1182521 cp_printer
        /workspace/install/gcc/src/gcc/gcc/cp/error.cc:4721
0x5df8091 format_phase_2
        /workspace/install/gcc/src/gcc/gcc/pretty-print.cc:2158
0x5df4514 pretty_printer::format(text_info&)
        /workspace/install/gcc/src/gcc/gcc/pretty-print.cc:1711
0x18ac446 pp_format(pretty_printer*, text_info*)
        /workspace/install/gcc/src/gcc/gcc/pretty-print.h:594
0x5df8c98 pp_format_verbatim(pretty_printer*, text_info*)
        /workspace/install/gcc/src/gcc/gcc/pretty-print.cc:2339
0x5df9ebe pp_verbatim(pretty_printer*, char const*, ...)
        /workspace/install/gcc/src/gcc/gcc/pretty-print.cc:2618
0x117ec1d print_instantiation_full_context
        /workspace/install/gcc/src/gcc/gcc/cp/error.cc:3889
0x117f54f maybe_print_instantiation_context
        /workspace/install/gcc/src/gcc/gcc/cp/error.cc:4107
0x117c22e cp_diagnostic_text_starter
        /workspace/install/gcc/src/gcc/gcc/cp/error.cc:3720
0x5d996ef diagnostic_text_output_format::on_report_diagnostic(diagnostic_info
const&, diagnostic_t)
        /workspace/install/gcc/src/gcc/gcc/diagnostic-format-text.cc:209
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

The gcc version I used is:

Using built-in specs.
COLLECT_GCC=/workspace/install/gcc/install_15.2.0/bin/gcc
COLLECT_LTO_WRAPPER=/workspace/install/gcc/install_15.2.0/libexec/gcc/x86_64-pc-linux-gnu/15.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /workspace/install/gcc/src/gcc/configure --enable-coverage
--enable-checking --disable-multilib --disable-shared --disable-bootstrap
--enable-languages=c,c++ --prefix=/workspace/install/gcc/install_15.2.0
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.2.0 (GCC)

Reply via email to