sc/source/filter/oox/tablecolumnsbuffer.cxx |    7 +++++++
 sw/source/core/txtnode/atrfld.cxx           |    8 ++++++++
 2 files changed, 15 insertions(+)

New commits:
commit 446f995f8695f74a32448f6b16e5c5adc6faf230
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Thu Jan 22 10:17:04 2026 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Thu Jan 22 22:49:32 2026 +0100

    Silence spurious -Werror=uninitialized and -Werror=maybe-uninitialized
    
    seen at least with recent GCC 16 trunk,
    
    > In file included from sw/inc/swatrset.hxx:22,
    >                  from sw/inc/format.hxx:27,
    >                  from sw/inc/fchrfmt.hxx:23,
    >                  from sw/inc/txatbase.hxx:33,
    >                  from sw/inc/txtfld.hxx:22,
    >                  from sw/source/core/txtnode/atrfld.cxx:25:
    > In member function ‘SfxPoolItemHolder::operator bool() const’,
    >     inlined from ‘const SfxPoolItem& SwTextAttr::GetAttr() const’ at 
sw/inc/txatbase.hxx:175:5,
    >     inlined from ‘SfxPoolItem& SwTextAttr::GetAttr()’ at 
sw/inc/txatbase.hxx:181:65,
    >     inlined from ‘SwTextField::SwTextField(const SfxPoolItemHolder&, 
sal_Int32, bool)’ at sw/source/core/txtnode/atrfld.cxx:603:70:
    > include/svl/itemset.hxx:72:56: error: ‘*(const 
SfxPoolItemHolder*)((char*)<unknown> + 8).SfxPoolItemHolder::m_pItem’ is used 
uninitialized [-Werror=uninitialized]
    >    72 |     explicit operator bool() const { return nullptr != m_pItem; }
    >       |                                                        ^~~~~~~
    > In member function ‘bool SfxPoolItemHolder::isDeleted() const’,
    >     inlined from ‘const SfxPoolItem* SfxPoolItemHolder::getItem() const’ 
at include/svl/itemset.hxx:69:42,
    >     inlined from ‘const SfxPoolItem& SwTextAttr::GetAttr() const’ at 
sw/inc/txatbase.hxx:176:28,
    >     inlined from ‘SfxPoolItem& SwTextAttr::GetAttr()’ at 
sw/inc/txatbase.hxx:181:65,
    >     inlined from ‘SwTextField::SwTextField(const SfxPoolItemHolder&, 
sal_Int32, bool)’ at sw/source/core/txtnode/atrfld.cxx:603:70:
    > include/svl/itemset.hxx:62:37: error: ‘*(const 
SfxPoolItemHolder*)((char*)<unknown> + 8).SfxPoolItemHolder::m_bDeleted’ may be 
used uninitialized [-Werror=maybe-uninitialized]
    >    62 |     bool isDeleted() const { return m_bDeleted; }
    >       |                                     ^~~~~~~~~~
    
    Change-Id: Id02928cf69afa850f97fe3f1eff958055f2a9302
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197840
    Reviewed-by: Stephan Bergmann <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/source/core/txtnode/atrfld.cxx 
b/sw/source/core/txtnode/atrfld.cxx
index 2c204e017151..12ce251c8877 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -600,7 +600,15 @@ SwTextField::SwTextField(
     , m_aExpand()
     , m_pTextNode( nullptr )
 {
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#pragma GCC diagnostic ignored "-Wuninitialized"
+#endif
     SwFormatField& rSwFormatField(static_cast<SwFormatField&>(GetAttr()));
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic pop
+#endif
     m_aExpand = rSwFormatField.GetField()->ExpandField(bInClipboard, nullptr);
     rSwFormatField.SetTextField( *this );
     SetHasDummyChar(true);
commit 713e048c231f8b90c6a97c2487fd0502a4d960f5
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Thu Jan 22 10:06:02 2026 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Thu Jan 22 22:49:18 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/oox/helper/refvector.hxx:25,
    >                  from sc/source/filter/inc/tablecolumnsbuffer.hxx:22,
    >                  from sc/source/filter/oox/tablecolumnsbuffer.cxx:20:
    > In destructor ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, 
_Lp>::~_Sp_counted_ptr_inplace() [with _Tp = oox::xls::TableColumns; _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 = oox::xls::TableColumns; _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 
= oox::xls::TableColumn; __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<oox::xls::TableColumn>::~shared_ptr()’ 
at ~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:175:11,
    >     inlined from ‘oox::xls::TableColumn& 
oox::xls::TableColumns::createTableColumn()’ at 
sc/source/filter/oox/tablecolumnsbuffer.cxx:110:1:
    > ~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:670:45: error: array 
subscript ‘std::_Sp_counted_ptr_inplace<oox::xls::TableColumns, 
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/stdexcept_throw.h:57,
    >                  from 
~/gcc/inst/include/c++/16.0.1/bits/hashtable_policy.h:35,
    >                  from ~/gcc/inst/include/c++/16.0.1/bits/hashtable.h:37,
    >                  from 
~/gcc/inst/include/c++/16.0.1/bits/unordered_map.h:33,
    >                  from ~/gcc/inst/include/c++/16.0.1/unordered_map:43,
    >                  from ~/gcc/inst/include/c++/16.0.1/functional:80,
    >                  from include/oox/helper/refvector.hxx:24:
    > In member function ‘_Tp* std::__new_allocator<_Tp>::allocate(size_type, 
const void*) [with _Tp = std::_Sp_counted_ptr_inplace<oox::xls::TableColumn, 
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<oox::xls::TableColumn, 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<oox::xls::TableColumn, 
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<oox::xls::TableColumn, 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 = 
oox::xls::TableColumn; _Alloc = std::allocator<void>; _Args = 
{oox::xls::TableColumns&}; __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 = {oox::xls::TableColumns&}; _Tp = 
oox::xls::TableColumn; __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 = {oox::xls::TableColumns&}; _Tp = 
oox::xls::TableColumn]’ 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 = oox::xls::TableColumn; _Args = 
{oox::xls::TableColumns&}]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:1066:39,
    >     inlined from ‘oox::xls::TableColumn& 
oox::xls::TableColumns::createTableColumn()’ at 
sc/source/filter/oox/tablecolumnsbuffer.cxx:107:87:
    > ~/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 = oox::xls::TableColumns; _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 = oox::xls::TableColumns; _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 
= oox::xls::TableColumn; __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<oox::xls::TableColumn>::~shared_ptr()’ 
at ~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:175:11,
    >     inlined from ‘oox::xls::TableColumn& 
oox::xls::TableColumns::createTableColumn()’ at 
sc/source/filter/oox/tablecolumnsbuffer.cxx:110:1:
    > ~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:670:45: error: array 
subscript ‘std::_Sp_counted_ptr_inplace<oox::xls::TableColumns, 
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<oox::xls::TableColumn, 
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<oox::xls::TableColumn, 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<oox::xls::TableColumn, 
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<oox::xls::TableColumn, 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 = 
oox::xls::TableColumn; _Alloc = std::allocator<void>; _Args = 
{oox::xls::TableColumns&}; __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 = {oox::xls::TableColumns&}; _Tp = 
oox::xls::TableColumn; __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 = {oox::xls::TableColumns&}; _Tp = 
oox::xls::TableColumn]’ 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 = oox::xls::TableColumn; _Args = 
{oox::xls::TableColumns&}]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:1066:39,
    >     inlined from ‘oox::xls::TableColumn& 
oox::xls::TableColumns::createTableColumn()’ at 
sc/source/filter/oox/tablecolumnsbuffer.cxx:107:87:
    > ~/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: I5f42c82dba453bd656fc16173a08d19d61186bbc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197837
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/sc/source/filter/oox/tablecolumnsbuffer.cxx 
b/sc/source/filter/oox/tablecolumnsbuffer.cxx
index 0611d3690c2e..d15eaa322744 100644
--- a/sc/source/filter/oox/tablecolumnsbuffer.cxx
+++ b/sc/source/filter/oox/tablecolumnsbuffer.cxx
@@ -102,12 +102,19 @@ void TableColumns::importTableColumns( 
SequenceInputStream& /*rStrm*/ )
     (void) mnCount;
 }
 
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
 TableColumn& TableColumns::createTableColumn()
 {
     TableColumnVector::value_type xTableColumn = 
std::make_shared<TableColumn>( *this );
     maTableColumnVector.push_back( xTableColumn );
     return *xTableColumn;
 }
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic pop
+#endif
 
 bool TableColumns::finalizeImport( ScDBData* pDBData )
 {

Reply via email to