]> 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>
Sat, 8 Apr 2023 01:54:47 +0000 (13:54 +1200)
commitd50790177296d766ae6013b572397f3f89d52e02
treef5c6ce57c44a060a4ecac2a59e07bb7f201b5a99
parent271954a29589a061886a0abe34932f2db57a6e2e
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