From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D5C9638708FF; Tue, 2 Jun 2020 12:00:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5C9638708FF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591099228; bh=UlIpsh8b9DeNuSxGlWCTmQmLjvsvIArSkOIK3XcA/uA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PFrpthm6q1ha3XNvFouKrSF51swpoJHmQo/fO0fg9qp/tS0YD+lIwaZIGR69xyhCJ A1YFYnCT6a+itawA1oiF+ayvyXr4zAvJR7v8kMHUqd43e2+7oUMlC2qMAg005jPA3H pnOC9KvWMlDWc72pyu+1dnd87eMgizmQiQqypLG0= From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/95237] LOCAL_DECL_ALIGNMENT shrinks alignment, FAIL gcc.target/i386/pr69454-2.c Date: Tue, 02 Jun 2020 12:00:28 +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: 11.0 X-Bugzilla-Keywords: ice-on-valid-code, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: skpgkp2 at gmail dot com X-Bugzilla-Target-Milestone: 11.0 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2020 12:00:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95237 --- Comment #9 from rguenther at suse dot de --- On Tue, 2 Jun 2020, hjl.tools at gmail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95237 >=20 > --- Comment #8 from H.J. Lu --- > (In reply to Kito Cheng from comment #6) > > Created attachment 48658 [details] > > i386-Implement-ROUND_TYPE_ALIGN-to-make-sure-alignme.patch > >=20 > > Some optimization might made decision depend on the alignment, and alig= nment > > shrinking might made the decision become wrong. >=20 > Nothing will happen on i386 if alignment of long long isn't 8 bytes. GIMPLE passes see DECL_ALIGN and can for example elide runtime checks like if(_Alignof(var) !=3D 8) which is bogus when the actual alignment is not ensured. For this reason we cannot permit a larger aligment early and resort to a lower one later. > > So I prefer keep the assertion checking and implement ROUND_TYPE_ALIGN = for > > x86, so that it will set the alignment properly from the beginning. > >=20 > > PoC/untested patch attached. >=20 > The i386 psABI specifies 4 byte alignment for long long. But we want to > use 8 byte alignment if there is no ABI implication and no stack realignm= ent > is needed. Will ROUND_TYPE_ALIGN always align long long to 8 bytes? So what we want here is RTL expansion pad out stack slots if they know to be aligned but not adjust DECL_ALIGN. Not sure if there's already a target hook to pad out variables, if not this may be the way to get what you desire here. I guess the actual reason is crossing of cache-lines?=