From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5143E3857025; Tue, 18 May 2021 14:36:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5143E3857025 From: "avi@cloudius-systems.com" To: gdb-prs@sourceware.org Subject: [Bug threads/27886] New: static thread_local on aarch64 are broken in gdb Date: Tue, 18 May 2021 14:36:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: threads X-Bugzilla-Version: 10.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: avi@cloudius-systems.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 14:36:08 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27886 Bug ID: 27886 Summary: static thread_local on aarch64 are broken in gdb Product: gdb Version: 10.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: threads Assignee: unassigned at sourceware dot org Reporter: avi@cloudius-systems.com Target Milestone: --- Consider this small C++ program: =3D=3D=3D begin =3D=3D=3D struct kk { kk() =3D default; int x =3D 1, y =3D 2, z =3D 3; ~kk() {} }; namespace a { static thread_local kk v1; thread_local kk v2; void f(int x) { v1.x =3D v2.y =3D x; } int g() { return v1.x + v2.y; } } int main() { return 0; } =3D=3D=3D end =3D=3D=3D Compiling and linking it with -pthread -O3 -g, gcc and clang, I can examine both a::v1 and a::v2 on x86_64 with these commands: (gdb) start (gdb) p a::v1 (gdb) p a::v2 However, on aarch64, I get (gdb) p a::v1 $1 =3D (gdb) p a::v2 $2 =3D {x =3D 1, y =3D 2, z =3D 3} a::v1 is not optimized out, and the problem remains when I add a function t= hat returns a reference to a::v1 (thus forcing the compiler to retain the struc= ture in memory). In a more complicated project, I get a different error for static thread-lo= cals - the type is lost though the address is still visible to gdb. Since both g++ and clang++ yield the same result, I assume the problem is w= ith gdb. --=20 You are receiving this mail because: You are on the CC list for the bug.=