error: array subscript '' is partly outside array bounds of ''...
A free file archiver for extremely high compression
Brought to you by:
ipavlov
compiling with gcc-16-20251005 has the following errors
/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/bin/x86_64-libreelec-linux-gnu-g++ -O2 -c -Werror -Wall -Wextra -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -o _o/UserInputUtils.o ../../UI/Console/UserInputUtils.cpp
In file included from ../../Archive/../../Common/Common.h:11,
from ../../Archive/StdAfx.h:9,
from ../../Archive/HandlerCont.cpp:3:
In destructor 'CLocalProgress::~CLocalProgress()',
inlined from 'virtual ULONG CLocalProgress::Release()' at ../../Archive/../Common/ProgressUtils.h:11:1,
inlined from 'CMyComPtr<T>::~CMyComPtr() [with T = ICompressProgressInfo]' at ../../Archive/../Common/../../Common/MyCom.h:17:37,
inlined from 'virtual LONG NArchive::CHandlerImg::Extract(const UInt32*, UInt32, Int32, IArchiveExtractCallback*)' at ../../Archive/HandlerCont.cpp:283:5:
../../Archive/../Common/ProgressUtils.h:12:3: error: array subscript 'CLocalProgress[0]' is partly outside array bounds of 'unsigned char [32]' [-Werror=array-bounds=]
12 | CLocalProgress
| ^~~~~~~~~~~~~~
../../Archive/../../Common/Common0.h:207:34: note: in definition of macro 'Z7_class_final'
207 | #define Z7_class_final(c) class c Z7_final
| ^
../../Archive/../Common/ProgressUtils.h:11:1: note: in expansion of macro 'Z7_CLASS_IMP_COM_1'
11 | Z7_CLASS_IMP_COM_1(
| ^~~~~~~~~~~~~~~~~~
../../Archive/HandlerCont.cpp: In member function 'virtual LONG NArchive::CHandlerImg::Extract(const UInt32*, UInt32, Int32, IArchiveExtractCallback*)':
../../Archive/HandlerCont.cpp:278:75: note: object of size 32 allocated by 'operator new'
278 | CHandlerImgProgress *imgProgressSpec = new CHandlerImgProgress(*this);
| ^
cc1plus: all warnings being treated as errors
make: *** [../../7zip_gcc.mak:536: _o/HandlerCont.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from ../../Archive/Rar/../../Common/CreateCoder.h:6,
from ../../Archive/Rar/RarHandler.cpp:17:
In member function 'virtual ULONG CFilterCoder::AddRef()',
inlined from 'T* CMyComPtr<T>::operator=(T*) [with T = ICompressCoder]' at ../../Archive/Rar/../../Common/../../Common/MyCom.h:27:16,
inlined from 'T* CMyComPtr<T>::operator=(const CMyComPtr<T>&) [with T = ICompressCoder]' at ../../Archive/Rar/../../Common/../../Common/MyCom.h:33:56,
inlined from 'virtual LONG NArchive::NRar::CHandler::Extract(const UInt32*, UInt32, Int32, IArchiveExtractCallback*)' at ../../Archive/Rar/RarHandler.cpp:1679:21:
../../Archive/Rar/../../Common/../../Common/MyCom.h:383:16: error: array subscript 'CFilterCoder[0]' is partly outside array bounds of 'unsigned char [72]' [-Werror=array-bounds=]
383 | { return ++_m_RefCount; } \
| ^~~~~~~~~~~
../../Archive/Rar/../../Common/FilterCoder.h:163:3: note: in expansion of macro 'Z7_COM_ADDREF_RELEASE'
163 | Z7_COM_ADDREF_RELEASE
| ^~~~~~~~~~~~~~~~~~~~~
../../Archive/Rar/RarHandler.cpp: In member function 'virtual LONG NArchive::NRar::CHandler::Extract(const UInt32*, UInt32, Int32, IArchiveExtractCallback*)':
../../Archive/Rar/RarHandler.cpp:1464:57: note: object of size 72 allocated by 'operator new'
1464 | NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder;
| ^~~~~~~~~~
In member function 'virtual ULONG CFilterCoder::AddRef()',
inlined from 'T* CMyComPtr<T>::operator=(T*) [with T = ICompressCoder]' at ../../Archive/Rar/../../Common/../../Common/MyCom.h:27:16,
inlined from 'T* CMyComPtr<T>::operator=(const CMyComPtr<T>&) [with T = ICompressCoder]' at ../../Archive/Rar/../../Common/../../Common/MyCom.h:33:56,
inlined from 'virtual LONG NArchive::NRar::CHandler::Extract(const UInt32*, UInt32, Int32, IArchiveExtractCallback*)' at ../../Archive/Rar/RarHandler.cpp:1679:21:
../../Archive/Rar/../../Common/../../Common/MyCom.h:383:16: error: array subscript 'CFilterCoder[0]' is partly outside array bounds of 'unsigned char [72]' [-Werror=array-bounds=]
383 | { return ++_m_RefCount; } \
| ^~~~~~~~~~~
../../Archive/Rar/../../Common/FilterCoder.h:163:3: note: in expansion of macro 'Z7_COM_ADDREF_RELEASE'
163 | Z7_COM_ADDREF_RELEASE
| ^~~~~~~~~~~~~~~~~~~~~
../../Archive/Rar/RarHandler.cpp: In member function 'virtual LONG NArchive::NRar::CHandler::Extract(const UInt32*, UInt32, Int32, IArchiveExtractCallback*)':
../../Archive/Rar/RarHandler.cpp:1464:57: note: object of size 72 allocated by 'operator new'
1464 | NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder;
| ^~~~~~~~~~
cc1plus: all warnings being treated as errors
make: *** [../../7zip_gcc.mak:663: _o/RarHandler.o] Error 1
make: Leaving directory '/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/7-zip-25.01/.x86_64-libreelec-linux-gnu/CPP/7zip/Bundles/Alone2'
FAILURE: s/build 7-zip during make_target (package.mk)
I don't understand that error.
What about another gcc versions?
what version of 7-Zip do you compile?
retested with 26.00 release and gcc-16-20260208
below is the error output.
I suppose it's GCC-16 compiler bug.
There are two different classes in 7-zip code:
CHandlerImgProgressandCLocalProgress.Both these classes have same base class interface
ICompressProgressInfo.But GCC-16 compiler doesn't like that sizes of objects of these classes also are different. Maybe compiler tries to optimize the code and works incorrectly.
You can try to report that issue to GCC-16 developers.
Last edit: Igor Pavlov 2026-02-13
@ipavlov
Hello, I make fix patch for this issue.
This patch made for Debian 7zip package, and also useful for other Unix OSs.
https://tracker.debian.org/pkg/7zip
GCC16 shows the warning, if we have 2 classes:
CHandlerImgProgressandCLocalProgress.If we have only one class, there was no error.
If we add some dummy variables to one of these classes, it also work.
So I think that it's bug in GCC16.