include/tools/stream.hxx          |    2 +-
 sw/source/uibase/wrtsh/wrtsh1.cxx |    7 +++++++
 tools/source/stream/stream.cxx    |    2 ++
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 980612bf2d94acbea099bdc0de673deff2f279b6
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Thu Jan 22 10:21:12 2026 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Fri Jan 23 08:04:36 2026 +0100

    Silence spurious -Werror=array-bounds=
    
    seen at least with recent GCC 16 trunk,
    
    > In file included from ~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:53,
    >                  from ~/gcc/inst/include/c++/16.0.1/memory:82,
    >                  from include/rtl/stringconcat.hxx:22,
    >                  from include/rtl/string.hxx:51,
    >                  from include/rtl/ustring.hxx:45,
    >                  from include/com/sun/star/uno/Any.h:30,
    >                  from 
workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/uno/XInterface.hdl:6,
    >                  from 
workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/beans/XPropertySet.hdl:9,
    >                  from 
workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/beans/XPropertySet.hpp:6,
    >                  from sw/source/uibase/wrtsh/wrtsh1.cxx:20:
    > In destructor ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, 
_Lp>::~_Sp_counted_ptr_inplace() [with _Tp = SwContentControl; _Alloc = 
std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’,
    >     inlined from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, 
_Lp>::~_Sp_counted_ptr_inplace() [with _Tp = SwContentControl; _Alloc = 
std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:670:45,
    >     inlined from ‘void std::_Sp_counted_base<_Lp>::_M_destroy() [with 
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:143:9,
    >     inlined from ‘void std::_Sp_counted_base<_Lp>::_M_release() [with 
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:424:18,
    >     inlined from ‘void std::_Sp_counted_base<_Lp>::_M_release() [with 
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:392:5,
    >     inlined from ‘std::__shared_count<_Lp>::~__shared_count() [with 
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:1129:21,
    >     inlined from ‘std::__shared_ptr<_Tp, _Lp>::~__shared_ptr() [with _Tp 
= weld::MessageDialogController; __gnu_cxx::_Lock_policy _Lp = 
__gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:1603:7,
    >     inlined from 
‘std::shared_ptr<weld::MessageDialogController>::~shared_ptr()’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:175:11,
    >     inlined from ‘virtual void SwWrtShell::InfoReadOnlyDialog(bool) 
const’ at sw/source/uibase/wrtsh/wrtsh1.cxx:2834:5:
    > ~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:670:45: error: array 
subscript ‘std::_Sp_counted_ptr_inplace<SwContentControl, std::allocator<void>, 
__gnu_cxx::_S_atomic>[0]’ is partly outside array bounds of ‘unsigned char 
[80]’ [-Werror=array-bounds=]
    >   670 |       ~_Sp_counted_ptr_inplace() noexcept { }
    >       |                                             ^
    > In file included from 
~/gcc/inst/include/c++/16.0.1/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
    >                  from ~/gcc/inst/include/c++/16.0.1/bits/allocator.h:46,
    >                  from ~/gcc/inst/include/c++/16.0.1/string:46,
    >                  from 
~/gcc/inst/include/c++/16.0.1/bits/locale_classes.h:43,
    >                  from ~/gcc/inst/include/c++/16.0.1/bits/ios_base.h:43,
    >                  from ~/gcc/inst/include/c++/16.0.1/ios:46,
    >                  from ~/gcc/inst/include/c++/16.0.1/bits/ostream.h:43,
    >                  from ~/gcc/inst/include/c++/16.0.1/ostream:42,
    >                  from include/rtl/ustring.hxx:34:
    > In member function ‘_Tp* std::__new_allocator<_Tp>::allocate(size_type, 
const void*) [with _Tp = 
std::_Sp_counted_ptr_inplace<weld::MessageDialogController, 
std::allocator<void>, __gnu_cxx::_S_atomic>]’,
    >     inlined from ‘constexpr _Tp* std::allocator< <template-parameter-1-1> 
>::allocate(std::size_t) [with _Tp = 
std::_Sp_counted_ptr_inplace<weld::MessageDialogController, 
std::allocator<void>, __gnu_cxx::_S_atomic>]’ at 
~/gcc/inst/include/c++/16.0.1/bits/allocator.h:203:40,
    >     inlined from ‘static constexpr _Tp* 
std::allocator_traits<std::allocator<_CharT> >::allocate(allocator_type&, 
size_type) [with _Tp = 
std::_Sp_counted_ptr_inplace<weld::MessageDialogController, 
std::allocator<void>, __gnu_cxx::_S_atomic>]’ at 
~/gcc/inst/include/c++/16.0.1/bits/alloc_traits.h:614:28,
    >     inlined from ‘std::__allocated_ptr<_Alloc> 
std::__allocate_guarded(_Alloc&) [with _Alloc = 
allocator<_Sp_counted_ptr_inplace<weld::MessageDialogController, 
allocator<void>, __gnu_cxx::_S_atomic> >]’ at 
~/gcc/inst/include/c++/16.0.1/bits/allocated_ptr.h:103:69,
    >     inlined from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, 
std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = 
weld::MessageDialogController; _Alloc = std::allocator<void>; _Args = 
{weld::Window*, const char (&)[41], const char (&)[19]}; 
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:1027:9,
    >     inlined from ‘std::__shared_ptr<_Tp, 
_Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = 
std::allocator<void>; _Args = {weld::Window*, const char (&)[41], const char 
(&)[19]}; _Tp = weld::MessageDialogController; __gnu_cxx::_Lock_policy _Lp = 
__gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:1805:14,
    >     inlined from 
‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) 
[with _Alloc = std::allocator<void>; _Args = {weld::Window*, const char 
(&)[41], const char (&)[19]}; _Tp = weld::MessageDialogController]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:463:59,
    >     inlined from ‘std::shared_ptr<std::_NonArray<_Tp> > 
std::make_shared(_Args&& ...) [with _Tp = weld::MessageDialogController; _Args 
= {weld::Window*, const char (&)[41], const char (&)[19]}]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:1066:39,
    >     inlined from ‘virtual void SwWrtShell::InfoReadOnlyDialog(bool) 
const’ at sw/source/uibase/wrtsh/wrtsh1.cxx:2826:111:
    > ~/gcc/inst/include/c++/16.0.1/bits/new_allocator.h:151:73: note: object 
of size 80 allocated by ‘operator new’
    >   151 |     return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * 
sizeof(_Tp)));
    >       |                                                                   
  ^
    > In destructor ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, 
_Lp>::~_Sp_counted_ptr_inplace() [with _Tp = SwContentControl; _Alloc = 
std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’,
    >     inlined from ‘void std::_Sp_counted_ptr_inplace<_Tp, _Alloc, 
_Lp>::_M_destroy() [with _Tp = SwContentControl; _Alloc = std::allocator<void>; 
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:684:32,
    >     inlined from ‘void std::_Sp_counted_base<_Lp>::_M_release() [with 
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:424:18,
    >     inlined from ‘void std::_Sp_counted_base<_Lp>::_M_release() [with 
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:392:5,
    >     inlined from ‘std::__shared_count<_Lp>::~__shared_count() [with 
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:1129:21,
    >     inlined from ‘std::__shared_ptr<_Tp, _Lp>::~__shared_ptr() [with _Tp 
= weld::MessageDialogController; __gnu_cxx::_Lock_policy _Lp = 
__gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:1603:7,
    >     inlined from 
‘std::shared_ptr<weld::MessageDialogController>::~shared_ptr()’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:175:11,
    >     inlined from ‘virtual void SwWrtShell::InfoReadOnlyDialog(bool) 
const’ at sw/source/uibase/wrtsh/wrtsh1.cxx:2834:5:
    > ~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:670:45: error: array 
subscript ‘std::_Sp_counted_ptr_inplace<SwContentControl, std::allocator<void>, 
__gnu_cxx::_S_atomic>[0]’ is partly outside array bounds of ‘unsigned char 
[80]’ [-Werror=array-bounds=]
    >   670 |       ~_Sp_counted_ptr_inplace() noexcept { }
    >       |                                             ^
    > In member function ‘_Tp* std::__new_allocator<_Tp>::allocate(size_type, 
const void*) [with _Tp = 
std::_Sp_counted_ptr_inplace<weld::MessageDialogController, 
std::allocator<void>, __gnu_cxx::_S_atomic>]’,
    >     inlined from ‘constexpr _Tp* std::allocator< <template-parameter-1-1> 
>::allocate(std::size_t) [with _Tp = 
std::_Sp_counted_ptr_inplace<weld::MessageDialogController, 
std::allocator<void>, __gnu_cxx::_S_atomic>]’ at 
~/gcc/inst/include/c++/16.0.1/bits/allocator.h:203:40,
    >     inlined from ‘static constexpr _Tp* 
std::allocator_traits<std::allocator<_CharT> >::allocate(allocator_type&, 
size_type) [with _Tp = 
std::_Sp_counted_ptr_inplace<weld::MessageDialogController, 
std::allocator<void>, __gnu_cxx::_S_atomic>]’ at 
~/gcc/inst/include/c++/16.0.1/bits/alloc_traits.h:614:28,
    >     inlined from ‘std::__allocated_ptr<_Alloc> 
std::__allocate_guarded(_Alloc&) [with _Alloc = 
allocator<_Sp_counted_ptr_inplace<weld::MessageDialogController, 
allocator<void>, __gnu_cxx::_S_atomic> >]’ at 
~/gcc/inst/include/c++/16.0.1/bits/allocated_ptr.h:103:69,
    >     inlined from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, 
std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = 
weld::MessageDialogController; _Alloc = std::allocator<void>; _Args = 
{weld::Window*, const char (&)[41], const char (&)[19]}; 
__gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:1027:9,
    >     inlined from ‘std::__shared_ptr<_Tp, 
_Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = 
std::allocator<void>; _Args = {weld::Window*, const char (&)[41], const char 
(&)[19]}; _Tp = weld::MessageDialogController; __gnu_cxx::_Lock_policy _Lp = 
__gnu_cxx::_S_atomic]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:1805:14,
    >     inlined from 
‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) 
[with _Alloc = std::allocator<void>; _Args = {weld::Window*, const char 
(&)[41], const char (&)[19]}; _Tp = weld::MessageDialogController]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:463:59,
    >     inlined from ‘std::shared_ptr<std::_NonArray<_Tp> > 
std::make_shared(_Args&& ...) [with _Tp = weld::MessageDialogController; _Args 
= {weld::Window*, const char (&)[41], const char (&)[19]}]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:1066:39,
    >     inlined from ‘virtual void SwWrtShell::InfoReadOnlyDialog(bool) 
const’ at sw/source/uibase/wrtsh/wrtsh1.cxx:2826:111:
    > ~/gcc/inst/include/c++/16.0.1/bits/new_allocator.h:151:73: note: object 
of size 80 allocated by ‘operator new’
    >   151 |     return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * 
sizeof(_Tp)));
    >       |                                                                   
  ^
    
    Change-Id: I54717f79621f31061a424fb27204e574b5c7dde1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197841
    Reviewed-by: Stephan Bergmann <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index bbfb85dd7ae4..671d5e1e2e6c 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -2824,6 +2824,10 @@ bool SwWrtShell::HasFoldedOutlineContentSelected() const
 
 void SwWrtShell::InfoReadOnlyDialog(bool bAsync) const
 {
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
     if (bAsync)
     {
         auto xInfo = std::make_shared<weld::MessageDialogController>(
@@ -2851,6 +2855,9 @@ void SwWrtShell::InfoReadOnlyDialog(bool bAsync) const
         }
         xInfo->run();
     }
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic pop
+#endif
 }
 
 bool SwWrtShell::WarnHiddenSectionDialog() const
commit e3ea377f2daa2756a412dd974eb39fd9f5db1366
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Thu Jan 22 14:09:56 2026 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Fri Jan 23 08:04:24 2026 +0100

    Make a virtual function non-inline
    
    ...which helps avoid some supposedly spurious -Werror=free-nonheap-object 
seen
    at least with recent GCC 16 trunk,
    
    > In destructor ‘virtual SvLockBytes::~SvLockBytes()’,
    >     inlined from ‘void SvRefBase::ReleaseRef()’ at 
include/tools/ref.hxx:160:36,
    >     inlined from ‘tools::SvRef<T>::~SvRef() [with T = 
writerfilter::rtftok::RTFTokenizer]’ at include/tools/ref.hxx:56:46,
    >     inlined from ‘writerfilter::rtftok::RTFLookahead::~RTFLookahead()’ at 
sw/source/writerfilter/rtftok/rtflookahead.cxx:37:1:
    > include/tools/stream.hxx:115:48: error: ‘void operator delete(void*, 
std::size_t)’ called on pointer 
‘((tools::SvRef<writerfilter::rtftok::RTFTokenizer>*)this)[1].tools::SvRef<writerfilter::rtftok::RTFTokenizer>::pObj’
 with nonzero offset 56 [-Werror=free-nonheap-object]
    >   115 |     virtual ~SvLockBytes() override { close(); }
    >       |                                                ^
    
    etc.
    
    Change-Id: I26a599f0e3258e6bf6a4d6e63e559b41029862db
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197842
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index 38c072fe038a..43c2b028d36c 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -112,7 +112,7 @@ public:
 
     SvLockBytes() : m_bSync(false) {}
 
-    virtual ~SvLockBytes() override { close(); }
+    virtual ~SvLockBytes() override;
 
     void            SetSynchronMode(bool bTheSync = true) { m_bSync = 
bTheSync; }
     bool            IsSynchronMode() const { return m_bSync; }
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 16e5e0fbb703..2cb511e9896d 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -155,6 +155,8 @@ void SvStream::writeNumberWithoutSwap_(const void * 
pDataSrc, int nDataSize)
 }
 
 
+SvLockBytes::~SvLockBytes() { close(); }
+
 void SvLockBytes::close()
 {
     (void)this;

Reply via email to