From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 401F0383D818; Fri, 11 Jun 2021 12:25:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 401F0383D818 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/101023] [11/12 Regression] wrong code with -mstackrealign Date: Fri, 11 Jun 2021 12:25:46 +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: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools at gmail dot com 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: 11.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: everconfirmed cf_reconfirmed_on bug_status 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: Fri, 11 Jun 2021 12:25:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101023 H.J. Lu changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2021-06-11 Status|UNCONFIRMED |WAITING --- Comment #2 from H.J. Lu --- (In reply to Zdenek Sojka from comment #0) > Created attachment 50981 [details] > auto-reduced testcase (from OpenTTD sources) >=20 > Compiler output: > $ x86_64-pc-linux-gnu-g++ -O2 -mtune=3Dopteron -mstackrealign > --param=3Dhot-bb-frequency-fraction=3D1 testcase.C -S >=20 > The offending code is: > .L8: > pushq %rbp > .cfi_def_cfa_offset 16 > .cfi_offset 6, -16 > movq %rsp, %rbp > .cfi_def_cfa_register 6 > movq %r12, -8(%rbp) > pushq %rax >=20 > the "push" overwrites r12 stored just one instruction above; when returni= ng: > movq -8(%rbp), %r12 > xorl %eax, %eax > leave > .cfi_def_cfa 7, 8 > ret >=20 > the wrong data is restored to r12 >=20 > I wasn't able yet to generate an executable testcase, but I can try to if > needed. (it shouldn't be that hard, just r12 needs to be used by the call= er > during the call) Please create a run-time testcase.=