From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 127D0393BC2A; Fri, 23 Apr 2021 12:57:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 127D0393BC2A From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/100152] [10/11/12 Regression] used caller-saved register not preserved across a call. Date: Fri, 23 Apr 2021 12:57:27 +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: 10.3.0 X-Bugzilla-Keywords: ra, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.4 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: Fri, 23 Apr 2021 12:57:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100152 --- Comment #39 from Richard Biener --- (In reply to Iain Sandoe from comment #38) > (In reply to Richard Biener from comment #37) > > Oh, and FYI a cc1 cross from x86_64 to x86_64-apple-darwin19.6.0 doesn'= t seem > > to reproduce the issue with the reduced testcase (I seee no call to > > ___UTF_8_put remaining with -O3 -fPIC -fno-strict-aliasing -fwrapv). >=20 > I think my interestingness test isn't strict enough - the creduced code > resulting doesn't have an extern for ___UTF_8_put and only seems to not > inline that fn because the interface has been mangled. [ so that the fn is > legitimately binds_localP as the pasted case ]. >=20 > if you still have the build around, out of curiosity, does it fail on the > original .i file attached here? >=20 > and with -fno-trapping-math -fno-math-errno -fschedule-insns2 > -fomit-frame-pointer >=20 > ( I only need O2 to get a fail ). Yes, with -O2 -fno-trapping-math -fno-math-errno -fschedule-insns2 -fomit-frame-pointer it produces the problematical .align 4,0x90 L945: movl 0(%rbp,%r10,4), %esi call ____UTF_8_put movq %r10, %rax addq $1, %r10 cmpq %rax, %r12 jne L945 code. But then ___UTF_8_put isn't interposable so I wonder why the linker even has to resolve anything. Adding -fPIC OTOH should definitely make the symbol interposable but the same code is still generated ... Note the 'extern' declaration shouldn't change anything, only that we see a definition is relevant. breaking on darwin_binds_local_p I see ___UTF_8_put is considered binding local even with -fPIC. So GCC thinks there will be no linker stub involved. Note 'shlib' is passed as false to default_binds_local_p_3 computed as 3140 on earlier system versions, and with a TODO to complete. */ 3141 bool force_overridable =3D TARGET_KEXTABI && DARWIN_VTABLE_P (dec= l); 3142 return default_binds_local_p_3 (decl, force_overridable /* shlib = */, 3143 false /* weak dominate */, and default_binds_local_p_3 would do /* If PIC, then assume that any global name can be overridden by symbols resolved from other modules. */ if (shlib) return false; ix86_binds_local_p simply passes flag_shlib !=3D 0 as this argument.=