From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 47D2B3858D35; Mon, 28 Aug 2023 14:46:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47D2B3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693234014; bh=SCn7fKuTtC8Q5yJ51bZDGXXXlIebJnuOI2U2/4tlmKw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wmk6fX70oEQx7CZ2uQNBsZYUz8mO5YUW3iL0KtFzxJOKcjDpfoK00+CSst0YuPgSK WDA/mG3plMLOo5MufH4s6WfakFyaYAsIGZyvn5EiLHHZrS3zHlB7ejXrQq0BhWjDki sy5pes5V7/Kx0GLEyso3UsyyHDv/CzgCcu2OMP7o= From: "tg at mirbsd dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111165] [13 regression] builtin strchr miscompiles on Debian/x32 with dietlibc Date: Mon, 28 Aug 2023 14:46:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: tg at mirbsd dot org X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 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=3D111165 --- Comment #11 from Thorsten Glaser --- OK, to summarise: When using the original code but providing a wrapper function (in a separate CU) for strchr, it works. When replacing the strchr with strlen (which GCC also does), it fails even without the presence of dietlibc=E2=80=99s strlen. (And yes, disassembly of= main.o (where I added it) shows no call to dietlibc from xstrlen.) This doesn=E2=80=99t seem to be coupled to the name of the function (the wr= apper functions are called cstrchr and xstrlen, so the compiler cannot make any assumptions about them).=