basic/source/classes/sbxmod.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 56a43e096682b38780925e4ba8eb3e1bb056214a
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Thu Jan 22 09:42:29 2026 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Thu Jan 22 22:48:32 2026 +0100

    Silence spurious -Werror=array-bounds=
    
    seen at least with recent GCC 16 trunk,
    
    > In member function ‘virtual void SbModule::SetParent(SbxObject*)’,
    >     inlined from ‘virtual SbxVariable* SbModule::Find(const 
rtl::OUString&, SbxClassType)’ at basic/source/classes/sbxmod.cxx:653:36:
    > basic/source/classes/sbxmod.cxx:671:13: error: array subscript 
‘SbModule[0]’ is partly outside array bounds of ‘unsigned char [152]’ 
[-Werror=array-bounds=]
    >   671 |     pParent = p;
    >       |     ~~~~~~~~^~~
    > basic/source/classes/sbxmod.cxx: In member function ‘virtual SbxVariable* 
SbModule::Find(const rtl::OUString&, SbxClassType)’:
    > basic/source/classes/sbxmod.cxx:651:55: note: object of size 152 
allocated by ‘operator new’
    >   651 |                     pRes = new SbxVariable( SbxOBJECT );
    >       |                                                       ^
    
    Change-Id: I0823b28063b6e224f9cc28aee55fd21e2f21aa1a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197833
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index eb805132e111..6e502ceffbf1 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -650,7 +650,14 @@ SbxVariable* SbModule::Find( const OUString& rName, 
SbxClassType t )
 
                     pRes = new SbxVariable( SbxOBJECT );
                     pRes->SetName( aEnumName );
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
                     pRes->SetParent( this );
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 16
+#pragma GCC diagnostic pop
+#endif
                     pRes->SetFlag( SbxFlagBits::Read );
                     if( bPrivate )
                     {

Reply via email to