[PATCH v2] c++: Fix FAIL: g++.dg/tree-ssa/initlist-opt1.C
Marek Polacek
polacek@redhat.com
Thu Mar 27 18:12:56 GMT 2025
On Wed, Mar 26, 2025 at 05:57:51PM +0000, Jonathan Wakely wrote:
> On Wed, 26 Mar 2025 at 17:42, Jason Merrill <jason@redhat.com> wrote:
> >
> > On 3/26/25 6:14 AM, Jonathan Wakely wrote:
> > > My r15-8904-ge200f53a555651 changed the std::vector initializer-list
> > > constructor so that it calls a new _M_range_initialize_n function
> > > instead of _M_range_initialize. Change the scan-tree-dump pattern in
> > > this g++.dg test to match the new gimple output.
> > >
> > > gcc/testsuite/ChangeLog:
> > >
> > > * g++.dg/tree-ssa/initlist-opt1.C: Match _M_range_initialize_n
> > > instead of _M_range_initialize.
> > > ---
> > >
> > > Would anybody prefer a different pattern?
> > >
> > > e.g. just {_M_range_initialize_n<const char\* const\*} without
> > > the second template argument and '>' would work, and would be correct
> > > for the gcc-14 backport where the new function only has one template
> > > parameter.
> >
> > That sounds most convenient to me. I don't think the specific signature
> > is important, as long as it checks that we use range-initialization from
> > const char *.
>
> Agreed - so I've pushed the attached patch to trunk now, thanks.
> commit 101f302363e8773958887e00750098b760a5b6bd
> Author: Jonathan Wakely <jwakely@redhat.com>
> AuthorDate: Wed Mar 26 10:10:19 2025
> Commit: Jonathan Wakely <redi@gcc.gnu.org>
> CommitDate: Wed Mar 26 17:53:34 2025
>
> c++: Fix FAIL: g++.dg/tree-ssa/initlist-opt1.C
>
> My r15-8904-ge200f53a555651 changed the std::vector initializer-list
> constructor so that it calls a new _M_range_initialize_n function
> instead of _M_range_initialize. Change the scan-tree-dump pattern in
> this g++.dg test to match the new gimple output.
>
> gcc/testsuite/ChangeLog:
>
> * g++.dg/tree-ssa/initlist-opt1.C: Match _M_range_initialize_n
> instead of _M_range_initialize.
>
> diff --git a/gcc/testsuite/g++.dg/tree-ssa/initlist-opt1.C b/gcc/testsuite/g++.dg/tree-ssa/initlist-opt1.C
> index 89abdd90a82..976c3f30b16 100644
> --- a/gcc/testsuite/g++.dg/tree-ssa/initlist-opt1.C
> +++ b/gcc/testsuite/g++.dg/tree-ssa/initlist-opt1.C
> @@ -4,7 +4,7 @@
> // { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } }
>
> // Test that we do range-initialization from const char *.
> -// { dg-final { scan-tree-dump {_M_range_initialize<const char\* const\*>} "gimple" } }
> +// { dg-final { scan-tree-dump {_M_range_initialize_n<const char\* const\*} "gimple" } }
> // { dg-final { scan-tree-dump {static const char.*72} "gimple" } }
>
> #include <string>
Looks like g++.dg/tree-ssa/initlist-opt2.C needs the same fix.
Tested x86_64-pc-linux-gnu, applying to trunk.
-- >8 --
This test needs the same fix as g++.dg/tree-ssa/initlist-opt1.C in
r15-8934.
gcc/testsuite/ChangeLog:
* g++.dg/tree-ssa/initlist-opt2.C: Match _M_range_initialize_n
instead of _M_range_initialize.
---
gcc/testsuite/g++.dg/tree-ssa/initlist-opt2.C | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/testsuite/g++.dg/tree-ssa/initlist-opt2.C b/gcc/testsuite/g++.dg/tree-ssa/initlist-opt2.C
index 8080e9fbfbd..bc9b6cf3867 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/initlist-opt2.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/initlist-opt2.C
@@ -4,7 +4,7 @@
// { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } }
// Test that we do range-initialization from const char *.
-// { dg-final { scan-tree-dump {_M_range_initialize<const char\* const\*>} "gimple" } }
+// { dg-final { scan-tree-dump {_M_range_initialize_n<const char\* const\*} "gimple" } }
// And that the backing array is static.
// { dg-final { scan-tree-dump {static const char.*72} "gimple" } }
base-commit: 22f4125f19d58e30997518e22dfe0bae7cdbbcb6
--
2.49.0
More information about the Libstdc++
mailing list