https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103031
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-11-02 Priority|P3 |P1 Status|UNCONFIRMED |NEW Target Milestone|--- |12.0 Ever confirmed|0 |1 Component|middle-end |c --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- I suppose the frontend is calling fold_convert directly rather than fold_build1_initializer (FLOAT_EXPR, ...). The frontend ends up building this via #0 0x0000000000d53d87 in convert_to_real_1 ( type=<real_type 0x7ffff6566348 double>, expr=<integer_cst 0x7ffff6544540>, fold_p=true) at /home/rguenther/src/gcc3/gcc/convert.c:319 #1 0x0000000000d53f0a in convert_to_real ( type=<real_type 0x7ffff6566348 double>, expr=<integer_cst 0x7ffff6544540>) at /home/rguenther/src/gcc3/gcc/convert.c:347 #2 0x0000000000b3cb90 in convert (type=<real_type 0x7ffff6566348 double>, expr=<integer_cst 0x7ffff6544540>) at /home/rguenther/src/gcc3/gcc/c/c-convert.c:138 #3 0x0000000000b9f602 in convert_and_check (loc=242464, type=<real_type 0x7ffff6566348 double>, expr=<integer_cst 0x7ffff6544540>) at /home/rguenther/src/gcc3/gcc/c-family/c-common.c:1767 #4 0x0000000000b1055e in convert_for_assignment (location=242464, expr_loc=0, type=<real_type 0x7ffff6566348 double>, rhs=<integer_cst 0x7ffff6544540>, origtype=<tree 0x0>, errtype=ic_init, null_pointer_constant=false, fundecl=<tree 0x0>, function=<tree 0x0>, parmnum=0, warnopt=0) at /home/rguenther/src/gcc3/gcc/c/c-typeck.c:7032 #5 0x0000000000b18c6e in digest_init (init_loc=242464, type=<real_type 0x7ffff6566348 double>, init=<integer_cst 0x7ffff6544540>, origtype=<tree 0x0>, null_pointer_constant=false, strict_string=true, require_constant=1) at /home/rguenther/src/gcc3/gcc/c/c-typeck.c:8217 #6 0x0000000000b16df8 in store_init_value (init_loc=242464, decl=<var_decl 0x7ffff7ff5c60 x>, init=<integer_cst 0x7ffff6544540>, --Type <RET> for more, q to quit, c to continue without paging-- origtype=<tree 0x0>) at /home/rguenther/src/gcc3/gcc/c/c-typeck.c:7762 #7 0x0000000000ace0e7 in finish_decl (decl=<var_decl 0x7ffff7ff5c60 x>, init_loc=242464, init=<integer_cst 0x7ffff6544540>, origtype=<tree 0x0>, asmspec_tree=<tree 0x0>) at /home/rguenther/src/gcc3/gcc/c/c-decl.c:5363 maybe convert_for_assignment needs to do something similar as START/END_FOLD_INIT around the convert_and_check or convert_for_assignment is not the correct thing to call here. It's also odd that convert_to_real says fold_p == true to convert_to_real_1 but that function doesn't actually fold anything (maybe that's just all dead code). I'm quite sure that initializer_constant_valid_p isn't the one that has to accept a FLOAT_EXPR here. C frontend maintainers need to sort this out.