[squid-dev] Latest Clang build errors

Alex Rousskov rousskov at measurement-factory.com
Wed Mar 29 13:57:02 UTC 2023


On 3/28/23 09:27, Amos Jeffries wrote:
> Alex, since the whole IPC and SHM system is your design are you able to 
> work on fixing the FlexibleArray build errors we are now getting with 
> clang v15.

Sure, I will work on this. I doubt I will be able to post a fix in the 
next few days due to travel, but I am sure we can figure it out in a 
week or so.

Alex.


> [1] Log excerpt from Jenkins:
> 
> 01:00:06 In file included from ../../../../src/ipc/StoreMap.h:12,
> 01:00:06                  from ../../../../src/fs/rock/RockRebuild.h:17,
> 01:00:06                  from ../../../../src/fs/rock/RockRebuild.cc:15:
> 01:00:06 In member function 'Item& 
> Ipc::Mem::FlexibleArray<Item>::operator[](int) [with Item = long 
> unsigned int]',
> 01:00:06     inlined from 'Ipc::StoreMapItems<C>::Item& 
> Ipc::StoreMapItems<C>::at(int) [with C = long unsigned int]' at 
> ../../../../src/ipc/StoreMap.h:136:21,
> 01:00:06     inlined from 'Rock::LoadingEntry::LoadingEntry(sfileno, 
> Rock::LoadingParts&)' at ../../../../src/fs/rock/RockRebuild.cc:199:27:
> 01:00:06 ../../../../src/ipc/mem/FlexibleArray.h:34:52: error: array 
> subscript -1 is below array bounds of 'long unsigned int [1]' 
> [-Werror=array-bounds=]
> 01:00:06    34 |     Item &operator [](const int idx) { return 
> items[idx]; }
> 01:00:06       | ~~~~~^
> 01:00:06 ../../../../src/ipc/mem/FlexibleArray.h: In constructor 
> 'Rock::LoadingEntry::LoadingEntry(sfileno, Rock::LoadingParts&)':
> 01:00:06 ../../../../src/ipc/mem/FlexibleArray.h:43:10: note: while 
> referencing 'Ipc::Mem::FlexibleArray<long unsigned int>::items'
> 01:00:06    43 |     Item items[1]; // ensures proper alignment of array 
> elements
> 01:00:06       |          ^~~~~
> 01:00:06 In member function 'Item& 
> Ipc::Mem::FlexibleArray<Item>::operator[](int) [with Item = unsigned int]',
> 01:00:06     inlined from 'Ipc::StoreMapItems<C>::Item& 
> Ipc::StoreMapItems<C>::at(int) [with C = unsigned int]' at 
> ../../../../src/ipc/StoreMap.h:136:21,
> 01:00:06     inlined from 'Rock::LoadingEntry::LoadingEntry(sfileno, 
> Rock::LoadingParts&)' at ../../../../src/fs/rock/RockRebuild.cc:200:33:
> 01:00:06 ../../../../src/ipc/mem/FlexibleArray.h:34:52: error: array 
> subscript -1 is below array bounds of 'unsigned int [1]' 
> [-Werror=array-bounds=]
> 01:00:06    34 |     Item &operator [](const int idx) { return 
> items[idx]; }
> 01:00:06       | ~~~~~^
> 01:00:06 ../../../../src/ipc/mem/FlexibleArray.h: In constructor 
> 'Rock::LoadingEntry::LoadingEntry(sfileno, Rock::LoadingParts&)':
> 01:00:06 ../../../../src/ipc/mem/FlexibleArray.h:43:10: note: while 
> referencing 'Ipc::Mem::FlexibleArray<unsigned int>::items'
> 01:00:06    43 |     Item items[1]; // ensures proper alignment of array 
> elements
> 01:00:06       |          ^~~~~
> 01:00:06 In member function 'Item& 
> Ipc::Mem::FlexibleArray<Item>::operator[](int) [with Item = int]',
> 01:00:06     inlined from 'Ipc::StoreMapItems<C>::Item& 
> Ipc::StoreMapItems<C>::at(int) [with C = int]' at 
> ../../../../src/ipc/StoreMap.h:136:21,
> 01:00:06     inlined from 'Rock::LoadingSlot::LoadingSlot(Rock::SlotId, 
> Rock::LoadingParts&)' at ../../../../src/fs/rock/RockRebuild.cc:208:27:
> 01:00:06 ../../../../src/ipc/mem/FlexibleArray.h:34:52: error: array 
> subscript -1 is below array bounds of 'int [1]' [-Werror=array-bounds=]
> 01:00:06    34 |     Item &operator [](const int idx) { return 
> items[idx]; }
> 01:00:06       | ~~~~~^
> 01:00:06 ../../../../src/ipc/mem/FlexibleArray.h: In constructor 
> 'Rock::LoadingSlot::LoadingSlot(Rock::SlotId, Rock::LoadingParts&)':
> 01:00:06 ../../../../src/ipc/mem/FlexibleArray.h:43:10: note: while 
> referencing 'Ipc::Mem::FlexibleArray<int>::items'
> 01:00:06    43 |     Item items[1]; // ensures proper alignment of array 
> elements
> 01:00:06       |          ^~~~~
> 01:00:06 cc1plus: all warnings being treated as errors
> 01:00:06 make[4]: *** [Makefile:986: rock/RockRebuild.lo] Error 1
> 01:00:06 make[4]: Leaving directory 
> '/srv/jenkins/workspace/5-pr-test/COMPILER/gcc/OS/fedora-rawhide/label/docker-build-host/btlayer-02-maximus/squid-7.0.0-VCS/_build/sub/src/fs'


More information about the squid-dev mailing list