From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CA6D0385840F; Tue, 22 Mar 2022 17:00:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA6D0385840F From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/102772] [12 regression] g++.dg/torture/pr80334.C FAILs Date: Tue, 22 Mar 2022 17:00:53 +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: testsuite-fail, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.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, 22 Mar 2022 17:00:53 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102772 --- Comment #17 from Jakub Jelinek --- (In reply to ro@CeBiTec.Uni-Bielefeld.DE from comment #16) > Same here: >=20 > Program Headers: > Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align > [...] > TLS 0x00c3d0 0x0806c3d0 0x00000000 0x00000 0x00024 RW 0x10 If both linkers reproduce the problem and the PT_TLS is 16-byte aligned and thr.1 in it is at offset 0 (or multiple of 16), then I'd think that poi= nts to the dynamic linker. The TLS transitions are performed by the linker. > > But the question is if in > > struct __attribute__((aligned (32))) S { long long buf[4]; }; > > __thread struct S s; > > S *foo (void) { return &s; } > > it won't return not properly 32-byte aligned pointer too (and is that i= n all > > threads or just some (initial vs. other threads)? >=20 > I've wrapped that in a small test programming, calling foo both from the > initial thread and a new one: in all cases, the return value from foo > was 32-byte aligned as expected. Perhaps the problem only shows when the PT_TLS size is not a multiple of the alignment? Or depends on other PT_TLS segments in shared libraries in the = same process. The pointer2.f90 testcase will link against libgomp which uses TL= S as well. So perhaps try: struct __attribute__((aligned (16))) S { char buf[0x24]; }; __thread struct S s; __attribute__((noipa)) S *foo (void) { return &s; } int main () { #pragma omp parallel __builtin_printf ("%p\n", foo ()); return 0; } ?=