https://gcc.gnu.org/g:a72e782528749bf553158039783ce79fa760e3a4
commit r14-11349-ga72e782528749bf553158039783ce79fa760e3a4 Author: Jason Merrill <ja...@redhat.com> Date: Tue Jan 28 17:39:41 2025 -0500 c++: disable initializer_list transformation PRs 118673 and 118285 are wrong-code bugs with the transformation to build an initializer_list backing array from a static array of the initializer expressions; let's disable that transformation on the GCC 14 branch. PR c++/118673 PR c++/118285 gcc/cp/ChangeLog: * call.cc (convert_like_internal) [ck_list]: Stop using maybe_init_list_as_array for GCC 14. gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/initlist-opt5.C: Add xfail. Diff: --- gcc/cp/call.cc | 11 +---------- gcc/testsuite/g++.dg/tree-ssa/initlist-opt5.C | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index bb376d9cb136..f580c3f5442f 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -8690,16 +8690,7 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum, unsigned len = CONSTRUCTOR_NELTS (expr); tree array; - if (tree init = maybe_init_list_as_array (elttype, expr)) - { - elttype = cp_build_qualified_type - (elttype, cp_type_quals (elttype) | TYPE_QUAL_CONST); - array = build_array_of_n_type (elttype, len); - array = build_vec_init_expr (array, init, complain); - array = get_target_expr (array); - array = cp_build_addr_expr (array, complain); - } - else if (len) + if (len) { tree val; unsigned ix; diff --git a/gcc/testsuite/g++.dg/tree-ssa/initlist-opt5.C b/gcc/testsuite/g++.dg/tree-ssa/initlist-opt5.C index fc928bb54050..fea59b440b64 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/initlist-opt5.C +++ b/gcc/testsuite/g++.dg/tree-ssa/initlist-opt5.C @@ -3,7 +3,7 @@ // { dg-do compile { target c++11 } } // Check that we call the basic_string constructor once (and define it once). -// { dg-final { scan-tree-dump-times {>::basic_string} 2 "gimple" } } +// { dg-final { scan-tree-dump-times {>::basic_string} 2 "gimple" { xfail *-*-* } } } #include <string>