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

            Bug ID: 118124
           Summary: [15 Regression] ICE in in expand_expr_real_2, at
                    expr.cc:9761 on nss-3.101.2
           Product: gcc
           Version: 15.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 noticed build failure on nss-3.101.2 where the error did not make
sense on gcc-master from r15-6363-gd0635492172781. Did not bisect.

Extracted reproducer:

// $ cat blake2b_unittest.cc.cc
namespace std {
template <class> struct initializer_list {
private:
  int *_M_array;
  unsigned long _M_len;
};
struct vector {
  vector(initializer_list<char>);
};
} // namespace std
std::vector kat_data{
    6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2,   3,   4, 5, 6, 7,
    8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4,   5,   6, 7, 8, 9,
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6,   7,   8, 9, 0, 1,
    2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 208, 209, 0, 1, 2, 3,
    4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,   1,   2, 3, 4, 5,
    6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2,   3,   4, 5};

Crashing:

$ gcc/xg++ -Bgcc -c blake2b_unittest.cc.cc -Wno-narrowing
blake2b_unittest.cc.cc:17:68: internal compiler error: in expand_expr_real_2,
at expr.cc:9761
   17 |     6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2,   3,   4, 5};
      |                                                                    ^
0x28e0704 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x28f2f20 internal_error(char const*, ...)
        ???:0
0x28dc884 fancy_abort(char const*, int, char const*)
        ???:0
0xe1af07 expand_expr_real_2(separate_ops const*, rtx_def*, machine_mode,
expand_modifier)
        ???:0
0xe25704 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ???:0
0xe25cba expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
        ???:0
0x1710ad1 output_constant(tree_node*, unsigned long, unsigned int, bool, bool)
        ???:0
0x171215d output_constructor(tree_node*, unsigned long, unsigned int, bool,
oc_outer_state*)
        ???:0
0x1711517 output_constant(tree_node*, unsigned long, unsigned int, bool, bool)
        ???:0
0x17140de assemble_variable_contents(tree_node*, char const*, bool, bool)
        ???:0
0x171f251 assemble_variable(tree_node*, int, int, int)
        ???:0
0x1723dbb varpool_node::assemble_decl()
        ???:0
0xd306cd cgraph_order_sort::process()
        ???:0
0xd31b20 symbol_table::compile()
        ???:0
0xd3488e symbol_table::finalize_compilation_unit()
        ???: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://gcc.gnu.org/bugs/> for instructions.

Note that -Wnarrowing produces an odd error:

$ gcc/xg++ -Bgcc -c blake2b_unittest.cc.cc
blake2b_unittest.cc.cc:17:67: error: narrowing conversion of ‘‘raw_data_cst’
not supported by dump_expr<expression error>’ from ‘int’ to ‘char’
[-Wnarrowing]
   17 |     6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2,   3,   4, 5};
      |                                                                   ^

The code built successfully with a yesterday's gcc-master from
r15-6326-g74d6a676034b3a.

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 15.0.0 20241219 (experimental) (GCC)

Reply via email to