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

            Bug ID: 118856
           Summary: [15 Regression] ICE in gimplify_var_or_parm_decl at
                    gimplify.cc:3346 on mesonlsp-4.3.7
           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: ---

Noticed ICE of gcc-master from r15-7494-g30dfcecddc6260 (did not bisect yet) on
mesonlsp-4.3.7

Minimized example:

// $ cat test.cpp.cpp
namespace std {
template <class> struct initializer_list {
  int *_M_array;
  unsigned long _M_len;
};
} // namespace std
template <typename, typename> struct __normal_iterator {
  int operator*();
  void operator++();
};
template <typename _Iterator, typename _Container>
bool operator==(__normal_iterator<_Iterator, _Container>,
                __normal_iterator<_Iterator, _Container>);
namespace std {
class Trans_NS___cxx11_basic_string typedef string;
struct Trans_NS___cxx11_basic_string {
  Trans_NS___cxx11_basic_string(const char *);
};
template <typename _Tp> struct vector {
  vector(initializer_list<_Tp>);
  template <typename _InputIterator> vector(_InputIterator, _InputIterator);
  __normal_iterator<int, int> begin();
  __normal_iterator<int, int> end();
};
} // namespace std
void UtilsTest_testReplace_TestTestBody() {
  for (auto vec : std::vector<std::vector<std::string>>{{""}})
    ;
}

Crashing:

$ gcc/xg++ -Bgcc -std=gnu++23 -o bug.o -c test.cpp.cpp
test.cpp.cpp: In function ‘void UtilsTest_testReplace_TestTestBody()’:
test.cpp.cpp:27:61: internal compiler error: in gimplify_var_or_parm_decl, at
gimplify.cc:3346
   27 |   for (auto vec : std::vector<std::vector<std::string>>{{""}})
      |                                                             ^
0x2916a51 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x2929cb5 internal_error(char const*, ...)
        ???:0
0x2912bdc fancy_abort(char const*, int, char const*)
        ???:0
0xf3da3f gimplify_var_or_parm_decl(tree_node**)
        ???:0
0xf47aa5 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xf5f51d gimplify_addr_expr(tree_node**, gimple**, gimple**)
        ???:0
0xf46573 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xf51699 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int, bool)
        ???:0
0xf517e0 gimplify_arg(tree_node**, gimple**, unsigned long, bool)
        ???:0
0x8c18f1 cp_gimplify_arg(tree_node**, gimple**, unsigned long, bool)
        ???:0
0x8cc05e cp_gimplify_expr(tree_node**, gimple**, gimple**)
        ???:0
0xf48dfa gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xf49487 gimplify_stmt(tree_node**, gimple**)
        ???:0
0xf49f53 gimplify_compound_expr(tree_node**, gimple**, bool)
        ???:0
0xf5cc8c gimplify_modify_expr_rhs(tree_node**, tree_node**, tree_node**,
gimple**, gimple**, bool)
        ???:0
0xf5d60b gimplify_modify_expr(tree_node**, gimple**, gimple**, bool)
        ???:0
0xf46287 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xf49487 gimplify_stmt(tree_node**, gimple**)
        ???:0
0xf494b3 gimplify_and_add(tree_node*, gimple**)
        ???:0
0xf5b08f gimplify_init_ctor_eval(tree_node*, vec<constructor_elt, va_gc,
vl_embed>*, gimple**, 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://gcc.gnu.org/bugs/> for instructions.

$ 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.1 20250212 (experimental) (GCC)

Reply via email to