From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6BDE838582AF; Wed, 14 Sep 2022 18:41:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BDE838582AF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663180898; bh=1lRDzroQOKnbiT9jRyxBemO76kcUDTH/LmobA1+Ro5k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jemjd+JlHVCITA6wj6nnmDK160/G/2F1z5tidaFx4Y+FRJ2hDUL79EQR8BdCzQTdd dCTwIAXO7C62MpD1QcYtk3qhRQ/+YvGA3E+1ZXC0kf7XwSyfriGxvql7pMklZakQCM 0zMdbpWZATXsRKjkjaj+0tZgrK3VkLCcASmtt0yY= From: "neoxic at icloud dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/106939] Linker-defined symbols are stained due to 'array subscript is partly outside array bounds' warning Date: Wed, 14 Sep 2022 18:41:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: neoxic at icloud dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106939 --- Comment #6 from Arseny Vakhrushev --- Lots of thanks again, Andrew! ---------------------------------------------- #include #include extern char _dst[], _src[], _end[]; int main(void) { memcpy(_dst, _src, _end - _src); uint32_t *dst =3D (uint32_t *)_dst; uint32_t *src =3D (uint32_t *)_src; uint32_t *end =3D (uint32_t *)_end; while (src < end) *dst++ =3D *src++; return 0; } ----------------------------------------------- Well, I hope I'm not doing anything terribly wrong, but the above works very nice for me, looks clean, involves pointer arithmetics and doesn't produce = any warnings. I also can't really understand how it is possible for pointer comparison to be undefined. If you could point me to the corresponding C standard section, I would really appreciate that! Thanks a lot again!=