]> 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)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 3 Apr 2023 21:04:17 +0000 (21:04 +0000)
commit6f6db8c5b76b4e49059cd348d0e7afb3616f0e6b
treebfab9896cf754cd516b05b36100143378e0addb5
parentec376e13b3c08efdd655ccf136f1abe3289954ba
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