]> git.ipfire.org Git - thirdparty/squid.git/commit
Fix GCC v13 build [-Warray-bounds] (#1318)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 2 Apr 2023 07:42:10 +0000 (07:42 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Fri, 21 Apr 2023 04:26:12 +0000 (16:26 +1200)
commit66ade3646c4cb735e36e28bb55bd0cbc5108e250
treec3aa0854c462c51151f43f20cb971e7c3e76b7b6
parentdf8da56b14065bf6337f861105a830a7e5a3cb0b
Fix GCC v13 build [-Warray-bounds] (#1318)

    src/ipc/mem/FlexibleArray.h:34:52: error: array subscript -1 is
    below array bounds of 'int [1]' [-Werror=array-bounds]

We suspect this warning is a GCC v13 regression bug because the callers
marked as problematic by GCC (e.g., Rock::LoadingEntry::LoadingEntry) do
not use "array subscript -1", and the Ipc::StoreMapItems::at() operator
they use even asserts that the subscript is not negative. It might be
GCC bug 107699: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107699

This change replaces the fake one-item array hack with a properly
aligned byte (still used as the "start of the real array" marker).

Also removed some unused and problematic code (instead of polishing it).
src/ipc/mem/FlexibleArray.h