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

            Bug ID: 119354
           Summary: ICE: error reporting routines re-entered. with
                    -mfunction-return=thunk -mindirect-branch=thunk-inline
                    -fcf-protection
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Compiler output:
$ x86_64-pc-linux-gnu-g++ -mfunction-return=thunk
-mindirect-branch=thunk-inline -fcf-protection testcase.C
testcase.C: In function 'int __char_traits_cmp_cat()':
testcase.C:1:47: error: '-mindirect-branch' and '-fcf-protection' are not
compatible [-Wtemplate-body]
    1 | template <typename> int __char_traits_cmp_cat() { return 0; }
      |                                               ^
testcase.C:1:47: error: '-mfunction-return' and '-fcf-protection' are not
compatible [-Wtemplate-body]
testcase.C: In function 'decltype (__char_traits_cmp_cat<_Traits>())
operatorXXX()':
testcase.C:5:8: error: '-mindirect-branch' and '-fcf-protection' are not
compatible [-Wtemplate-body]
    5 |     -> decltype(__char_traits_cmp_cat<_Traits>()) { return 0; }
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
testcase.C:5:8: error: '-mfunction-return' and '-fcf-protection' are not
compatible [-Wtemplate-body]
testcase.C: In function 'int value()':
testcase.C:7:11: error: '-mindirect-branch' and '-fcf-protection' are not
compatible
    7 | int value() { return operatorXXX<char>(); }
      |           ^
testcase.C:7:11: error: '-mfunction-return' and '-fcf-protection' are not
compatible

internal compiler error: error reporting routines re-entered.
0x3105c41 error(char const*, ...)
        /repo/gcc-trunk/gcc/diagnostic-global-context.cc:397
0x1ecfde5 ix86_set_current_function(tree_node*)
        /repo/gcc-trunk/gcc/config/i386/i386-options.cc:3614
0x158bca4 invoke_set_current_function_hook
        /repo/gcc-trunk/gcc/function.cc:4694
0x158dfe4 invoke_set_current_function_hook
        /repo/gcc-trunk/gcc/function.cc:190
0x158dfe4 set_function_decl
        /repo/gcc-trunk/gcc/function.cc:4723
0x158dfe4 set_cfun(function*, bool)
        /repo/gcc-trunk/gcc/function.cc:4733
0x158dfe4 pop_function_context()
        /repo/gcc-trunk/gcc/function.cc:184
0x117622c pop_from_top_level()
        /repo/gcc-trunk/gcc/cp/name-lookup.cc:8791
0x124f500 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        /repo/gcc-trunk/gcc/cp/pt.cc:23231
0x1000447 add_template_candidate_real
        /repo/gcc-trunk/gcc/cp/call.cc:3723
0x10015bb add_template_candidate
        /repo/gcc-trunk/gcc/cp/call.cc:3813
0x10015bb add_candidates
        /repo/gcc-trunk/gcc/cp/call.cc:6851
0x1002111 add_candidates
        /repo/gcc-trunk/gcc/cp/call.cc:5100
0x1002111 perform_overload_resolution
        /repo/gcc-trunk/gcc/cp/call.cc:5117
0x1007f12 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        /repo/gcc-trunk/gcc/cp/call.cc:5218
0x1270231 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**,
bool, bool, int)
        /repo/gcc-trunk/gcc/cp/semantics.cc:3504
0x122def7 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        /repo/gcc-trunk/gcc/cp/pt.cc:21540
0x1225388 tsubst(tree_node*, tree_node*, int, tree_node*)
        /repo/gcc-trunk/gcc/cp/pt.cc:17183
0x10ea5cc dump_template_bindings
        /repo/gcc-trunk/gcc/cp/error.cc:596
0x10e3963 dump_function_decl
        /repo/gcc-trunk/gcc/cp/error.cc:1982
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.

$ x86_64-pc-linux-gnu-g++ -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-g++
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-20250317001648-r15-8081-ga3ead22b42de8d-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/15.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --enable-libsanitizer
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-20250317001648-r15-8081-ga3ead22b42de8d-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.0.1 20250317 (experimental) (GCC)

Reply via email to