[squid-dev] Latest Clang build errors

Francesco Chemolli gkinkie at gmail.com
Tue Mar 28 14:04:30 UTC 2023


Hi all,
  that is not just with clang:
https://build.squid-cache.org/job/trunk-amd64-matrix/COMPILER=gcc,CPU=amd64,OS=fedora-rawhide,force_on_docker_arm64=docker-build-host-lowpri/434/console
shows the error on gcc 13.

I recall a conversation where Alex showed it to be a compiler issue, but I
can't find it now.

On Tue, Mar 28, 2023 at 2:27 PM Amos Jeffries <squid3 at treenet.co.nz> 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.
>
> IIRC FlexibleArray was a placeholder for std::dynarray, which is now
> officially dead. So if we can do an implementation which uses more
> standard behaviour it would be better.
>
> Cheers
> Amos
>
>
> [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'
>
> _______________________________________________
> squid-dev mailing list
> squid-dev at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-dev
>


-- 
    Francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20230328/ee3cd16a/attachment.htm>


More information about the squid-dev mailing list