From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B23B438515F6; Wed, 14 Sep 2022 16:09:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B23B438515F6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663171793; bh=+q1YJO1p/rsTcyc3FP7g/rCSGXuNsXE7PGIquDGudaA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=X6hw3UAJIP377VzYlsamFmCDAGNwy6njg/0WX2EJ86EPrgiKbY1WGaPy+dKP/k3FE MdjAKWQWv3KT5JymOsIn8WcJZLXpsZIJ2VQ01Z93d2f5yuGNpg4kfuaw+KMAjQZeQn o39Xuq3cxzWqDsmEOukbBQ99l2IEkGFCPYjmJQlg= From: "pinskia at gcc dot gnu.org" 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 16:09:53 +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: pinskia at gcc dot gnu.org 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 #5 from Andrew Pinski --- (In reply to Arseny Vakhrushev from comment #4) > Thanks a lot, Andrew! Totally my bad. Well, comparison seems to work too: >=20 > extern char _src[], _dst[], _end[]; // Defined by the linker > int main(void) { > char *src =3D &_src[0]; > char *dst =3D &_dst[0]; > char *end =3D &_end[0]; > while (src < end) *dst++ =3D *src++; > return 0; > } >=20 > Are the asm("" : "+r" (p)) statements strictly needed? The inline-asm is needed because in C it is undefined to compare pointers t= hat are from different arrays. Basically it is a way to hide it from the compil= er.=