https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
Bug ID: 116424 Summary: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dansimon09 at gmail dot com Target Milestone: --- I'm encountering an ICE with gcc-14.0.1 on ubuntu24.04 when compiling the following code. I also see the error reproduced with gcc-trunk on compiler explorer. Code: ```c++ #include <ranges> #include <CLI/CLI.hpp> #include <fmt/format.h> class EndsWithValidator: public CLI::CustomValidator { public: EndsWithValidator(std::string ext, bool case_sensitive = true) noexcept(false) : CLI::CustomValidator() { desc_function_ = [desc=fmt::format("Ends With {}", ext)](){ return desc; }; name_ = fmt::format("String Ends With {} Validator", ext); non_modifying_ = true; if (case_sensitive) { func_ = [ext=std::move(ext)](const std::string& string){ return string.ends_with(ext) ? std::string{} : fmt::format(R"(String "{}" does not end with "{}")", string, ext); }; } else { std::ranges::for_each(ext, [](auto& c){ c = std::tolower(c); }); func_ = [ext=std::move(ext)](std::string string){ std::ranges::for_each(string, [](auto& c){ c = std::tolower(c); }); return string.ends_with(ext) ? std::string{} : fmt::format(R"(String "{}" does not end with "{}" (case insensitive))", string, ext); }; } } }; static const CLI::CustomValidator ExtensionJSONGLTFValidator = EndsWithValidator(".gltf", false); static const CLI::CustomValidator ExtensionGLBValidator = EndsWithValidator(".glb", false); static const CLI::CustomValidator ExtensionGLTFValidator(ExtensionJSONGLTFValidator | ExtensionGLBValidator); ``` Compiler output: ``` FAILED: Consumer.cpp.o /usr/bin/g++-14 -D_GLIBCXX_USE_CXX11_ABI=1 -D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING -isystem project/cmake-build-debug-gnu-intel/vcpkg_installed/x64-linux/include -g -std=gnu++20 -fdiagnostics-color=always -MD -MT Consumer.cpp.o -MF Consumer.cpp.o.d -fmodules-ts -fmodule-mapper=Consumer.cpp.o.modmap -MD -fdeps-format=p1689r5 -x c++ -o Consumer.cpp.o -c project/Consumer.cpp In file included from project/Consumer.cpp:22: project/Validators.hpp: In function ‘void __static_initialization_and_destruction_0()’: project/Validators.hpp:32:85: internal compiler error: in cp_gimplify_expr, at cp/cp-gimplify.cc:904 60 | static const CLI::CustomValidator ExtensionGLTFValidator(ExtensionJSONGLTFValidator | ExtensionGLBValidator); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ 0x732c70 cp_gimplify_expr(tree_node**, gimple**, gimple**) ../../src/gcc/cp/cp-gimplify.cc:904 0x14bd34d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../src/gcc/gimplify.cc:17789 0x14c8860 gimplify_addr_expr ../../src/gcc/gimplify.cc:6911 0x14be0b7 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../src/gcc/gimplify.cc:17930 0x14d0341 gimplify_expr ../../src/gcc/gimplify.cc:18952 0x14d0341 gimplify_arg(tree_node**, gimple**, unsigned int, bool) ../../src/gcc/gimplify.cc:3778 0x14d09e3 gimplify_call_expr ../../src/gcc/gimplify.cc:4063 0x14be026 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../src/gcc/gimplify.cc:17852 0x14d61c3 gimplify_cleanup_point_expr ../../src/gcc/gimplify.cc:7577 0x14be007 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../src/gcc/gimplify.cc:18276 0x14c036a gimplify_stmt(tree_node**, gimple**) ../../src/gcc/gimplify.cc:7577 0x14bee1b gimplify_statement_list ../../src/gcc/gimplify.cc:2249 0x14bee1b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../src/gcc/gimplify.cc:18328 0x14d582f gimplify_stmt(tree_node**, gimple**) ../../src/gcc/gimplify.cc:7577 0x14d582f gimplify_body(tree_node*, bool) ../../src/gcc/gimplify.cc:19150 0x14d5c5a gimplify_function_tree(tree_node*) ../../src/gcc/gimplify.cc:19351 0x12e1317 cgraph_node::analyze() ../../src/gcc/cgraphunit.cc:687 0x12e3e97 analyze_functions ../../src/gcc/cgraphunit.cc:1251 0x12e4e21 symbol_table::finalize_compilation_unit() ../../src/gcc/cgraphunit.cc:2560 ```