public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "michal.chojnowski at scylladb dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug exp/30271] Addresses of static thread_local fields are badly calculated sometimes Date: Sun, 26 Mar 2023 01:21:20 +0000 [thread overview] Message-ID: <bug-30271-4717-jxxQf6VvMx@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-30271-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=30271 --- Comment #3 from Michal Chojnowski <michal.chojnowski at scylladb dot com> --- I managed to boil it down to a minimal example. I've added the test case as an attachment. As it turns out, the problem happens because `cooked_index_functions::expand_symtabs_matching` fails to expand the symtabs which contain the definitions of the static fields, because cooked index entries corresponding to static fields don't have parent_entry set. (For this part of the bug, thread_local is not relevant — this happens for any static field, but only thread_local messes up the fallback code path which happens after the lookup fails). This only happens when the test is compiled with clang, though. (I tested that with clang++ 15.0.7). It doesn't seem to happen with gcc. (I tested that with g++ 12.2.1). If the relevant symtab is expanded beforehand, e.g. by another lookup, then the lookup of the static field won't fail. This makes the bug quite hard to hit. In many cases, the relevant symtab is expanded by the lookup of the class which occurs immediately before the lookup of the field. That's why two files are needed in the test — the class lookup expands one symtab, and so the lookup of one field doesn't fail, but it doesn't expand the other symtab and the lookup of the other field fails. Note that this problem with symtabs is orthogonal to the problem with `value_static_field` which I described in earlier comments. If this turns out to be a clang bug, `value_static_field` may still deserve a fix. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2023-03-26 1:21 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-24 18:44 [Bug exp/30271] New: " michal.chojnowski at scylladb dot com 2023-03-25 16:37 ` [Bug exp/30271] " tromey at sourceware dot org 2023-03-25 16:38 ` tromey at sourceware dot org 2023-03-25 20:28 ` tromey at sourceware dot org 2023-03-26 0:56 ` michal.chojnowski at scylladb dot com 2023-03-26 1:21 ` michal.chojnowski at scylladb dot com [this message] 2023-03-31 17:04 ` tromey at sourceware dot org 2023-03-31 17:12 ` tromey at sourceware dot org 2023-03-31 17:54 ` tromey at sourceware dot org 2023-03-31 18:00 ` tromey at sourceware dot org 2023-03-31 18:03 ` tromey at sourceware dot org 2023-05-10 23:28 ` tromey at sourceware dot org 2023-05-15 14:51 ` cvs-commit at gcc dot gnu.org 2023-05-15 15:06 ` michal.chojnowski at scylladb dot com 2023-05-15 15:16 ` cvs-commit at gcc dot gnu.org 2023-05-15 15:17 ` tromey at sourceware dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-30271-4717-jxxQf6VvMx@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).