[med-svn] [Git][med-team/hopscotch-map][master] 3 commits: Cherry-pick upstream patch to fix undefined behaviour with C++17

Balint Reczey (@rbalint) gitlab at salsa.debian.org
Fri Jul 8 22:30:43 BST 2022



Balint Reczey pushed to branch master at Debian Med / hopscotch-map


Commits:
025503e4 by Balint Reczey at 2022-07-08T14:56:29+02:00
Cherry-pick upstream patch to fix undefined behaviour with C++17

and later standards

- - - - -
d76c5a1a by Balint Reczey at 2022-07-08T14:56:35+02:00
routine-update: Standards-Version: 4.6.1

- - - - -
69da5c70 by Balint Reczey at 2022-07-08T14:56:35+02:00
Update changelog

- - - - -


4 changed files:

- debian/changelog
- debian/control
- + debian/patches/0001-When-using-C-17-std-launder-the-reinterpreted-pointe.patch
- + debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+hopscotch-map (2.3.0-3) UNRELEASED; urgency=medium
+
+  * Cherry-pick upstream patch to fix undefined behaviour with C++17
+    and later standards
+  * routine-update: Standards-Version: 4.6.1
+
+ -- Balint Reczey <balint at balintreczey.hu>  Fri, 08 Jul 2022 14:47:31 +0200
+
 hopscotch-map (2.3.0-2) unstable; urgency=medium
 
   * Team upload


=====================================
debian/control
=====================================
@@ -6,7 +6,7 @@ Uploaders: Michael R. Crusoe <crusoe at debian.org>
 Build-Depends: debhelper-compat (= 13),
                cmake,
                libboost-test-dev
-Standards-Version: 4.6.0
+Standards-Version: 4.6.1
 Vcs-Browser: https://salsa.debian.org/med-team/hopscotch-map
 Vcs-Git: https://salsa.debian.org/med-team/hopscotch-map.git
 Homepage: https://github.com/Tessil/hopscotch-map/


=====================================
debian/patches/0001-When-using-C-17-std-launder-the-reinterpreted-pointe.patch
=====================================
@@ -0,0 +1,45 @@
+From 44423162aa804616327306bd38c47a094a7e6096 Mon Sep 17 00:00:00 2001
+From: Tessil <tessil at gmx.com>
+Date: Sat, 21 May 2022 20:19:21 +0100
+Subject: [PATCH] When using C++17, std::launder the reinterpreted pointer from
+ std::aligned_storage to adapt to the change of object model introduced in
+ P0137R1. Fix potential undefined behaviour.
+
+C++17 introduced a change in the object model with P0137R1 which now requires the reinterpreted pointer from std::aligned_storage to be laundered. See the following discussion for some details https://stackoverflow.com/questions/47735657/does-reinterpret-casting-stdaligned-storage-to-t-without-stdlaunder-violat
+---
+ include/tsl/hopscotch_hash.h | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+--- a/include/tsl/hopscotch_hash.h
++++ b/include/tsl/hopscotch_hash.h
+@@ -36,6 +36,7 @@
+ #include <iterator>
+ #include <limits>
+ #include <memory>
++#include <new>
+ #include <stdexcept>
+ #include <tuple>
+ #include <type_traits>
+@@ -326,12 +327,22 @@
+     
+     value_type& value() noexcept {
+         tsl_hh_assert(!empty());
++#if defined(__cplusplus) && __cplusplus >= 201703L
++        return *std::launder(
++            reinterpret_cast<value_type*>(std::addressof(m_value)));
++#else
+         return *reinterpret_cast<value_type*>(std::addressof(m_value));
++#endif
+     }
+     
+     const value_type& value() const noexcept {
+         tsl_hh_assert(!empty());
++#if defined(__cplusplus) && __cplusplus >= 201703L
++        return *std::launder(
++            reinterpret_cast<const value_type*>(std::addressof(m_value)));
++#else
+         return *reinterpret_cast<const value_type*>(std::addressof(m_value));
++#endif
+     }
+     
+     template<typename... Args>


=====================================
debian/patches/series
=====================================
@@ -0,0 +1 @@
+0001-When-using-C-17-std-launder-the-reinterpreted-pointe.patch



View it on GitLab: https://salsa.debian.org/med-team/hopscotch-map/-/compare/c612f14221d5b084021fab2d4ac5847167cb6d47...69da5c70932c0593c22d66925f80b21615252b86

-- 
View it on GitLab: https://salsa.debian.org/med-team/hopscotch-map/-/compare/c612f14221d5b084021fab2d4ac5847167cb6d47...69da5c70932c0593c22d66925f80b21615252b86
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220708/b21af110/attachment-0001.htm>


More information about the debian-med-commit mailing list