https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118573
Bug ID: 118573
Summary: internal compiler error: in gimplify_var_or_parm_decl
Product: gcc
Version: 14.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: morinim at gmail dot com
Target Milestone: ---
The following code result in ICE:
---
#include <limits>
#include <string>
#include <variant>
#include <vector>
using value_t = std::variant<double, std::string>;
struct debug_params
{
debug_params(const std::vector<value_t> &v) : params(v) {}
std::vector<value_t> params;
};
int main()
{
const auto inf(std::numeric_limits<double>::infinity());
debug_params dp({-inf});
// same with: debug_params dp({+inf, +inf});
}
---
I compiled it with gcc version 14.2.0 under Slackware64 15.0 (g++ -Wall -Wextra
--std=c++20 -freport-bug ice.cc):
ice.cc:20:1: internal compiler error: in gimplify_var_or_parm_decl, at
gimplify.cc:3308
20 | }
| ^
0x1ff4db8 internal_error(char const*, ...)
???:0
0x771294 fancy_abort(char const*, int, char const*)
???:0
0xc3237c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
The same problem happens when compiling with g++ version 13.3.0 available under
Ubuntu 24.04 (ubuntu-latest in Github actions).
Notes
- Removing the minus before `inf` (`debug_params dp({inf});`) avoids ICE.
- Changing const into constexpr (`constexpr auto
inf(std::numeric_limits<double>::infinity());`) avoids ICE.
- Adding different optimisation flags (-O0, -O2) does not prevent the ICE.
The issue appears to be consistent across GCC versions and platforms. Please
let me know if further information or testing is needed.