public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Uros Bizjak <uros@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-11352] tsan: Don't instrument non-generic AS accesses [PR111736] Date: Wed, 24 Apr 2024 14:40:03 +0000 (GMT) [thread overview] Message-ID: <20240424144004.429AC3849AE3@sourceware.org> (raw) https://gcc.gnu.org/g:09910b6753427eeb3f6dded4fae3578851da7422 commit r11-11352-g09910b6753427eeb3f6dded4fae3578851da7422 Author: Jakub Jelinek <jakub@redhat.com> Date: Tue Mar 26 11:06:15 2024 +0100 tsan: Don't instrument non-generic AS accesses [PR111736] Similar to the asan and ubsan changes, we shouldn't instrument non-generic address space accesses with tsan, because we just have library functions which take address of the objects as generic address space pointers, so they can't handle anything else. 2024-03-26 Jakub Jelinek <jakub@redhat.com> gcc/ChangeLog: PR sanitizer/111736 * tsan.c (instrument_expr): Punt on non-generic address space accesses. gcc/testsuite/ChangeLog: * gcc.dg/tsan/pr111736.c: New test. (cherry picked from commit 471967ab8b4c49338ba77defbe24b06cc51c0093) Diff: --- gcc/testsuite/gcc.dg/tsan/pr111736.c | 17 +++++++++++++++++ gcc/tsan.c | 3 +++ 2 files changed, 20 insertions(+) diff --git a/gcc/testsuite/gcc.dg/tsan/pr111736.c b/gcc/testsuite/gcc.dg/tsan/pr111736.c new file mode 100644 index 00000000000..34ab88b3d4f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tsan/pr111736.c @@ -0,0 +1,17 @@ +/* PR sanitizer/111736 */ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-fsanitize=thread -fdump-tree-optimized -ffat-lto-objects" } */ +/* { dg-final { scan-tree-dump-not "__tsan_read" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "__tsan_write" "optimized" } } */ + +#ifdef __x86_64__ +#define SEG __seg_fs +#else +#define SEG __seg_gs +#endif + +void +foo (int SEG *p, int SEG *q) +{ + *q = *p; +} diff --git a/gcc/tsan.c b/gcc/tsan.c index 7db157e21e5..e426f647cb0 100644 --- a/gcc/tsan.c +++ b/gcc/tsan.c @@ -139,6 +139,9 @@ instrument_expr (gimple_stmt_iterator gsi, tree expr, bool is_write) if (TREE_READONLY (base) || (VAR_P (base) && DECL_HARD_REGISTER (base))) return false; + if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (TREE_TYPE (base)))) + return false; + stmt = gsi_stmt (gsi); loc = gimple_location (stmt); rhs = is_vptr_store (stmt, expr, is_write);
reply other threads:[~2024-04-24 14:40 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240424144004.429AC3849AE3@sourceware.org \ --to=uros@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.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).