From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EDF5C384A06B; Fri, 10 May 2024 12:11:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EDF5C384A06B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715343070; bh=BLlKkBO3uJRGufX8CDrK1GV7hgtVJBn3YMlxn1KwVlw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mvzwa2Ilj+ZMz6ThtYZIMVsTNnyZ5F56IpaVseLOH/+qHBQic0q8ZYxzTlsJyAkE2 XHmh3q0TQ0BHuB4zeVEc8NP/ATwE753aC8LVfQWzn2ecup+mW0e1PaTDZK0SOtmMeh MRY/9/6YYDzU8WVUWS0sjAJdZYtHXKpUuxcocqFA= From: "xry111 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/115014] GCC generates incorrect instructions for addressing the data segment through EBP register Date: Fri, 10 May 2024 12:11:10 +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.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: xry111 at gcc dot gnu.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: --- 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=3D115014 --- Comment #11 from Xi Ruoyao --- (In reply to Andrew Pinski from comment #10) > int f(int *a) > { > int b; > size_t t =3D (size_t)&b; > size_t t1 =3D (size_t)a; > return *(int*)(((size_t)&b)+(t-t1)); > } >=20 > Is kinda of valid c but might fail with your definition. The result of integer-to-pointer conversion is implementation-defined, so i= t's not necessarily valid if the implementation has segmented memory.=