[gcc r12-10207] libstdc++: Fix a -Wsign-compare warning in std::list

Jonathan Wakely redi@gcc.gnu.org
Wed Mar 13 09:52:43 GMT 2024


https://gcc.gnu.org/g:6a858b742c12b82496cd45cfd8b776fbcb474d6b

commit r12-10207-g6a858b742c12b82496cd45cfd8b776fbcb474d6b
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Aug 9 11:28:56 2023 +0100

    libstdc++: Fix a -Wsign-compare warning in std::list
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/list.tcc (list::sort(Cmp)): Fix -Wsign-compare
            warning for loop condition.
    
    (cherry picked from commit 9bd194434acb47fac80aad45ed04039e0535d1fe)

Diff:
---
 libstdc++-v3/include/bits/list.tcc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/list.tcc b/libstdc++-v3/include/bits/list.tcc
index d6b6e975ff5..f3352be8258 100644
--- a/libstdc++-v3/include/bits/list.tcc
+++ b/libstdc++-v3/include/bits/list.tcc
@@ -654,7 +654,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 	    {
 	      // Move all nodes back into *this.
 	      __carry._M_put_all(end()._M_node);
-	      for (int __i = 0; __i < sizeof(__tmp)/sizeof(__tmp[0]); ++__i)
+	      for (size_t __i = 0; __i < sizeof(__tmp)/sizeof(__tmp[0]); ++__i)
 		__tmp[__i]._M_put_all(end()._M_node);
 	      __throw_exception_again;
 	    }


More information about the Libstdc++-cvs mailing list