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

            Bug ID: 112869
           Summary: [14 regression] ICE at gimplify_expr, at
                    gimplify.cc:17531 on libopenmpt-0.7.3
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Initially observed ICE on gcc-master at r14-6191-g9c3a880feecf81 compiling
libopenmpt-0.7.3.

Extracted example:

$ cat a.cpp.cpp
void min(long, long);
template <class T> void Binaryread(int &, T, unsigned long);
template <> void Binaryread(int &, float, unsigned long bytecount) {
  min(bytecount, sizeof(int));
}

Crashing:

$ g++ -std=c++20 -c a.cpp.cpp -o a.o

a.cpp.cpp: In function 'void Binaryread(int&, T, long unsigned int) [with T =
float]':
a.cpp.cpp:4:18: internal compiler error: in gimplify_expr, at gimplify.cc:17531
    4 |   min(bytecount, sizeof(int));
      |                  ^~~~~~~~~~~
0x1fe24d4 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char
const*, __va_list_tag (*) [1], diagnostic_t)
        ???:0
0x1fe2cb9 internal_error(char const*, ...)
        ???:0
0x76d566 fancy_abort(char const*, int, char const*)
        ???:0
0x7387b4 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int) [clone .cold]
        ???:0
0xc30cb6 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xc35c39 gimplify_arg(tree_node**, gimple**, unsigned int, bool)
        ???:0
0xc35e9d gimplify_call_expr(tree_node**, gimple**, bool)
        ???:0
0xc3158e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xc34b33 gimplify_cleanup_point_expr(tree_node**, gimple**)
        ???:0
0xc315e2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xc3428e gimplify_body(tree_node*, bool)
        ???:0
0xc34650 gimplify_function_tree(tree_node*)
        ???:0
0xa9bf07 cgraph_node::analyze()
        ???:0
0xa9e607 analyze_functions(bool)
        ???:0
0xa9f27d symbol_table::finalize_compilation_unit()
        ???:0

$ LANG=C gcc/xg++ -Bgcc -v
Reading specs from gcc/specs
COLLECT_GCC=gcc/xg++
COLLECT_LTO_WRAPPER=gcc/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/slyfox/dev/git/gcc/configure --disable-multilib
--disable-bootstrap --disable-lto --disable-libsanitizer
--disable-libstdcxx-pch --enable-languages=c,c++ --disable-libgomp
--disable-libquadmath --disable-libvtv CFLAGS='-O1 -g0' CXXFLAGS='-O1 -g0'
LDFLAGS='-O1 -g0'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231205 (experimental) (GCC)

Reply via email to