summaryrefslogtreecommitdiff
path: root/external/mdds
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2023-07-25 10:47:07 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2023-07-31 16:50:10 +0200
commite7c4166f1e150b10bc2ac52e93f8ad7503db09dc (patch)
treee12c6c685aaac4ef0c7b8fb3a91d5c5e4fdd87e3 /external/mdds
parentdbe0ad486c60bde96b7f8019f31d855e3eae545b (diff)
silence use-after-free warning in mdds for gcc12 in optimized build
Change-Id: I15385718dd705128e9e02541f33e46069dec5251 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154890 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'external/mdds')
-rw-r--r--external/mdds/UnpackedTarball_mdds.mk1
-rw-r--r--external/mdds/gcc-12-silence-use-after-free.patch.142
2 files changed, 43 insertions, 0 deletions
diff --git a/external/mdds/UnpackedTarball_mdds.mk b/external/mdds/UnpackedTarball_mdds.mk
index 271d20b0f4d1..5745da0b11c5 100644
--- a/external/mdds/UnpackedTarball_mdds.mk
+++ b/external/mdds/UnpackedTarball_mdds.mk
@@ -15,6 +15,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,mdds,0))
$(eval $(call gb_UnpackedTarball_add_patches,mdds,\
external/mdds/use-after-free.patch \
+ external/mdds/gcc-12-silence-use-after-free.patch.1 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/mdds/gcc-12-silence-use-after-free.patch.1 b/external/mdds/gcc-12-silence-use-after-free.patch.1
new file mode 100644
index 000000000000..3f8dd0afe0f3
--- /dev/null
+++ b/external/mdds/gcc-12-silence-use-after-free.patch.1
@@ -0,0 +1,42 @@
+Workaround for gcc-toolset-12 on almalinux8 on a release/optimized build:
+[build CXX] sc/source/core/data/column2.cxx
+In file included from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/flat_segment_tree.hpp:37,
+ from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/sc/inc/columnspanset.hxx:16,
+ from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/sc/inc/column.hxx:25,
+ from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/sc/source/core/data/column2.cxx:20:
+In function ‘void mdds::__st::intrusive_ptr_release(node<T>*) [with T = mdds::flat_segment_tree<int, bool>]’,
+ inlined from ‘boost::intrusive_ptr<T>::~intrusive_ptr() [with T = mdds::__st::node<mdds::flat_segment_tree<int, bool> >]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/boost/boost/smart_ptr/intrusive_ptr.hpp:100:44,
+ inlined from ‘std::pair<mdds::flat_segment_tree<Key, Value>::const_iterator, bool> mdds::flat_segment_tree<Key, Value>::insert_segment_impl(key_type, key_type, value_type, bool) [with Key = int; Value = bool]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/flat_segment_tree_def.inl:225:1:
+/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/node.hpp:247:10: error: pointer used after ‘void operator delete(void*, std::size_t)’ [-Werror=use-after-free]
+ 247 | --p->refcount;
+ | ~~~^~~~~~~~
+In function ‘void mdds::__st::intrusive_ptr_release(node<T>*) [with T = mdds::flat_segment_tree<int, bool>]’,
+ inlined from ‘void mdds::__st::intrusive_ptr_release(node<T>*) [with T = mdds::flat_segment_tree<int, bool>]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/node.hpp:245:13,
+ inlined from ‘boost::intrusive_ptr<T>::~intrusive_ptr() [with T = mdds::__st::node<mdds::flat_segment_tree<int, bool> >]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/boost/boost/smart_ptr/intrusive_ptr.hpp:100:44,
+ inlined from ‘std::pair<mdds::flat_segment_tree<Key, Value>::const_iterator, bool> mdds::flat_segment_tree<Key, Value>::insert_segment_impl(key_type, key_type, value_type, bool) [with Key = int; Value = bool]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/flat_segment_tree_def.inl:224:93:
+/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/node.hpp:249:9: note: call to ‘void operator delete(void*, std::size_t)’ here
+ 249 | delete p;
+ | ^~~~~~~~
+cc1plus: all warnings being treated as errors
+
+diff -ur mdds.org/include/mdds/node.hpp mdds/include/mdds/node.hpp
+--- mdds.org/include/mdds/node.hpp 2023-07-24 18:27:14.427139325 +0000
++++ mdds/include/mdds/node.hpp 2023-07-24 18:26:54.554461294 +0000
+@@ -244,9 +244,15 @@
+ template<typename T>
+ inline void intrusive_ptr_release(node<T>* p)
+ {
+- --p->refcount;
+- if (!p->refcount)
++#if defined __GNUC__ && __GNUC__ == 12 && __GNUC_MINOR__ < 3 && !defined __clang__
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wuse-after-free"
++#endif
++ if(--p->refcount == 0)
+ delete p;
++#if defined __GNUC__ && __GNUC__ == 12 && __GNUC_MINOR__ < 3 && !defined __clang__
++#pragma GCC diagnostic pop
++#endif
+ }
+
+ template<typename T>