]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: disable initializer_list transformation
authorJason Merrill <jason@redhat.com>
Tue, 28 Jan 2025 22:39:41 +0000 (17:39 -0500)
committerJason Merrill <jason@redhat.com>
Thu, 27 Feb 2025 17:26:22 +0000 (12:26 -0500)
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.

gcc/cp/call.cc
gcc/testsuite/g++.dg/tree-ssa/initlist-opt5.C

index bb376d9cb136b045c72cb103182990d0899cab15..f580c3f5442fe40ae49937b07cd8f47137cdf582 100644 (file)
@@ -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;
 
index fc928bb540501d0df8d56b303a5d5f73fba74a55..fea59b440b642b6e921484d373d0ed38d7570416 100644 (file)
@@ -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>