sc/source/filter/oox/PivotTableFormat.cxx |    7 +++++++
 unoxml/source/dom/document.cxx            |    7 +++++++
 2 files changed, 14 insertions(+)

New commits:
commit 0bdb342a33d581324e00da74c795d41b0b543fed
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Thu Jan 22 09:58:09 2026 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Fri Jan 23 08:04:58 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 sc/source/filter/inc/workbookhelper.hxx:22,
    >                  from sc/source/filter/inc/PivotTableFormat.hxx:12,
    >                  from sc/source/filter/oox/PivotTableFormat.cxx:10:
    > In destructor ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, 
_Lp>::~_Sp_counted_ptr_inplace() [with _Tp = ScPatternAttr; _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 = ScPatternAttr; _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::PivotTableReference; __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::PivotTableReference>::~shared_ptr()’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:175:11,
    >     inlined from ‘oox::xls::PivotTableReference& 
oox::xls::PivotTableFormat::createReference()’ at 
sc/source/filter/oox/PivotTableFormat.cxx:128:1:
    > ~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:670:45: error: array 
subscript ‘std::_Sp_counted_ptr_inplace<ScPatternAttr, std::allocator<void>, 
__gnu_cxx::_S_atomic>[0]’ is partly outside array bounds of ‘unsigned char 
[120]’ [-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/memory:67:
    > In member function ‘_Tp* std::__new_allocator<_Tp>::allocate(size_type, 
const void*) [with _Tp = 
std::_Sp_counted_ptr_inplace<oox::xls::PivotTableReference, 
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::PivotTableReference, 
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<_Up> >::allocate(allocator_type&, 
size_type) [with _Tp = 
std::_Sp_counted_ptr_inplace<oox::xls::PivotTableReference, 
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::PivotTableReference, 
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::PivotTableReference; _Alloc = std::allocator<void>; _Args = 
{oox::xls::PivotTableFormat&}; __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::PivotTableFormat&}; _Tp = 
oox::xls::PivotTableReference; __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::PivotTableFormat&}; _Tp 
= oox::xls::PivotTableReference]’ 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::PivotTableReference; _Args 
= {oox::xls::PivotTableFormat&}]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:1066:39,
    >     inlined from ‘oox::xls::PivotTableReference& 
oox::xls::PivotTableFormat::createReference()’ at 
sc/source/filter/oox/PivotTableFormat.cxx:125:66:
    > ~/gcc/inst/include/c++/16.0.1/bits/new_allocator.h:151:73: note: object 
of size 120 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 = ScPatternAttr; _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 = ScPatternAttr; _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::PivotTableReference; __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::PivotTableReference>::~shared_ptr()’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:175:11,
    >     inlined from ‘oox::xls::PivotTableReference& 
oox::xls::PivotTableFormat::createReference()’ at 
sc/source/filter/oox/PivotTableFormat.cxx:128:1:
    > ~/gcc/inst/include/c++/16.0.1/bits/shared_ptr_base.h:670:45: error: array 
subscript ‘std::_Sp_counted_ptr_inplace<ScPatternAttr, std::allocator<void>, 
__gnu_cxx::_S_atomic>[0]’ is partly outside array bounds of ‘unsigned char 
[120]’ [-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::PivotTableReference, 
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::PivotTableReference, 
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<_Up> >::allocate(allocator_type&, 
size_type) [with _Tp = 
std::_Sp_counted_ptr_inplace<oox::xls::PivotTableReference, 
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::PivotTableReference, 
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::PivotTableReference; _Alloc = std::allocator<void>; _Args = 
{oox::xls::PivotTableFormat&}; __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::PivotTableFormat&}; _Tp = 
oox::xls::PivotTableReference; __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::PivotTableFormat&}; _Tp 
= oox::xls::PivotTableReference]’ 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::PivotTableReference; _Args 
= {oox::xls::PivotTableFormat&}]’ at 
~/gcc/inst/include/c++/16.0.1/bits/shared_ptr.h:1066:39,
    >     inlined from ‘oox::xls::PivotTableReference& 
oox::xls::PivotTableFormat::createReference()’ at 
sc/source/filter/oox/PivotTableFormat.cxx:125:66:
    > ~/gcc/inst/include/c++/16.0.1/bits/new_allocator.h:151:73: note: object 
of size 120 allocated by ‘operator new’
    >   151 |     return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * 
sizeof(_Tp)));
    >       |                                                                   
  ^
    
    Change-Id: Idfa85dda898dbcd3f5ff86a5b28c0ac3c84c4169
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197836
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/sc/source/filter/oox/PivotTableFormat.cxx 
b/sc/source/filter/oox/PivotTableFormat.cxx
index 48410d01ceda..a4e7b0bcf30a 100644
--- a/sc/source/filter/oox/PivotTableFormat.cxx
+++ b/sc/source/filter/oox/PivotTableFormat.cxx
@@ -120,12 +120,19 @@ void PivotTableFormat::finalizeImport()
     pSaveData->setFormats(aFormats);
 }
 
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
 PivotTableReference& PivotTableFormat::createReference()
 {
     auto xReference = std::make_shared<PivotTableReference>(*this);
     maReferences.push_back(xReference);
     return *xReference;
 }
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic pop
+#endif
 
 PivotTableReference::PivotTableReference(const PivotTableFormat& rFormat)
     : WorkbookHelper(rFormat)
commit aa228e60a52bed433d52e29adea2b15aa04de12c
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Thu Jan 22 14:20:21 2026 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Fri Jan 23 08:04:47 2026 +0100

    Silence spurious -Werror=maybe-uninitialized
    
    seen at least with recent GCC 16 trunk,
    
    > In file included from unoxml/source/dom/document.hxx:29,
    >                  from unoxml/source/dom/document.cxx:22:
    > In constructor ‘cppu::ImplInheritanceHelper<BaseClass, 
Ifc>::ImplInheritanceHelper(Arg&& ...) [with Arg = {DOM::CDocument&, 
osl::Mutex&, const com::sun::star::xml::dom::NodeType&, _xmlNode*}; BaseClass = 
DOM::CNode; Ifc = {com::sun::star::xml::dom::XDocument, 
com::sun::star::xml::dom::events::XDocumentEvent, 
com::sun::star::io::XActiveDataControl, com::sun::star::io::XActiveDataSource, 
com::sun::star::xml::sax::XSAXSerializable, 
com::sun::star::xml::sax::XFastSAXSerializable}]’,
    >     inlined from ‘DOM::CDocument::CDocument(xmlDocPtr)’ at 
unoxml/source/dom/document.cxx:92:58:
    > include/cppuhelper/implbase.hxx:152:44: error: ‘<unknown>’ may be used 
uninitialized [-Werror=maybe-uninitialized]
    >   152 |         BaseClass(std::forward<Arg>(arg)...)
    >       |                                            ^
    > In file included from unoxml/source/dom/document.hxx:50:
    > unoxml/inc/node.hxx: In constructor 
‘DOM::CDocument::CDocument(xmlDocPtr)’:
    > unoxml/inc/node.hxx:110:9: note: by argument 2 of type ‘const 
DOM::CDocument&’ to ‘DOM::CNode::CNode(const DOM::CDocument&, const 
osl::Mutex&, const com::sun::star::xml::dom::NodeType&, xmlNode* const&)’ 
declared here
    >   110 |         CNode(CDocument const& rDocument, ::osl::Mutex const& 
rMutex,
    >       |         ^~~~~
    > In constructor ‘cppu::ImplInheritanceHelper<BaseClass, 
Ifc>::ImplInheritanceHelper(Arg&& ...) [with Arg = {DOM::CDocument&, 
osl::Mutex&, const com::sun::star::xml::dom::NodeType&, _xmlNode*}; BaseClass = 
DOM::CNode; Ifc = {com::sun::star::xml::dom::XDocument, 
com::sun::star::xml::dom::events::XDocumentEvent, 
com::sun::star::io::XActiveDataControl, com::sun::star::io::XActiveDataSource, 
com::sun::star::xml::sax::XSAXSerializable, 
com::sun::star::xml::sax::XFastSAXSerializable}]’,
    >     inlined from ‘DOM::CDocument::CDocument(xmlDocPtr)’ at 
unoxml/source/dom/document.cxx:92:58:
    > include/cppuhelper/implbase.hxx:152:44: error: ‘<unknown>’ may be used 
uninitialized [-Werror=maybe-uninitialized]
    >   152 |         BaseClass(std::forward<Arg>(arg)...)
    >       |                                            ^
    > unoxml/inc/node.hxx: In constructor 
‘DOM::CDocument::CDocument(xmlDocPtr)’:
    > unoxml/inc/node.hxx:110:9: note: by argument 3 of type ‘const 
osl::Mutex&’ to ‘DOM::CNode::CNode(const DOM::CDocument&, const osl::Mutex&, 
const com::sun::star::xml::dom::NodeType&, xmlNode* const&)’ declared here
    >   110 |         CNode(CDocument const& rDocument, ::osl::Mutex const& 
rMutex,
    >       |         ^~~~~
    
    Change-Id: I9b422727d47b148faf9e7a62ce8220116e32479c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197843
    Reviewed-by: Stephan Bergmann <[email protected]>
    Tested-by: Jenkins

diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
index ab57e51b869a..f7058a3fa3d6 100644
--- a/unoxml/source/dom/document.cxx
+++ b/unoxml/source/dom/document.cxx
@@ -85,6 +85,10 @@ namespace DOM
         return cur;
     }
 
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
     CDocument::CDocument(xmlDocPtr const pDoc)
         : CDocument_Base(*this, m_Mutex,
                 NodeType_DOCUMENT_NODE, reinterpret_cast<xmlNodePtr>(pDoc))
@@ -92,6 +96,9 @@ namespace DOM
         , m_pEventDispatcher(new events::CEventDispatcher)
     {
     }
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic pop
+#endif
 
     ::rtl::Reference<CDocument> CDocument::CreateCDocument(xmlDocPtr const 
pDoc)
     {

Reply via email to