[committed] libstdc++: Fix reversed args in unreachable assumption [PR109849]

Message ID 20250115213808.1839448-1-jwakely@redhat.com
State Committed
Commit 6f85a97248fdff15aadc9514c1118eee0293d256
Headers
Series [committed] libstdc++: Fix reversed args in unreachable assumption [PR109849] |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 fail Patch failed to apply

Commit Message

Jonathan Wakely Jan. 15, 2025, 9:37 p.m. UTC
  libstdc++-v3/ChangeLog:

	PR libstdc++/109849
	* include/bits/vector.tcc (vector::_M_range_insert): Fix
	reversed args in length calculation.
---

Tested x86_64-linux, pushed to trunk. Backport to gcc-14 to follow after
testing.

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

Patch

diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc
index 44920a0549ab..4f4c366080be 100644
--- a/libstdc++-v3/include/bits/vector.tcc
+++ b/libstdc++-v3/include/bits/vector.tcc
@@ -934,7 +934,7 @@  _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 		const size_type __len =
 		  _M_check_len(__n, "vector::_M_range_insert");
 #if __cplusplus < 201103L
-		if (__len < (__n + (__old_start - __old_finish)))
+		if (__len < (__n + (__old_finish - __old_start)))
 		  __builtin_unreachable();
 #endif