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

            Bug ID: 105779
           Summary: internal_error on passing a pointer to static function
                    to another function
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bart at bartjanssens dot org
  Target Milestone: ---

Created attachment 53054
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53054&action=edit
Minimal example to reproduce this

Compiling the attached test case fails, explicitly adding & on line 23 to
indicate that method takes a pointer to a function solves the problem, but I
believe both should compile (and did prior to GCC 12), and certainly not crash.

Compile command: g++ -Wall -Wextra test-pointer.cpp
Output:
during RTL pass: expand
test-pointer.cpp: In member function ‘int
WrapSmartPointer::operator()(TypeWrapperT&&) [with TypeWrapperT = IntWrapper]’:
test-pointer.cpp:23:18: internal compiler error: Segmentation fault
   23 |     return method(DereferenceSmartPointer<WrappedT>::apply); //
method(&DereferenceSmartPointer<WrappedT>::apply) works
      |            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x1ac4724 internal_error(char const*, ...)
        ???:0
0x11072d7 make_decl_rtl(tree_node*)
        ???:0
0x95ad77 expand_call(tree_node*, rtx_def*, int)
        ???:0
0xab27af expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ???:0
0xa930b4 store_expr(tree_node*, rtx_def*, int, bool, bool)
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.

GCC version: g++ (GCC) 12.1.0 (Arch Linux package)
System: Linux 5.15.43-1-lts #1 SMP Wed, 25 May 2022 14:08:34 +0000 x86_64
GNU/Linux

Reply via email to