public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/99588] variable set but not used warning on static _Atomic assignment Date: Tue, 30 Mar 2021 22:41:23 +0000 [thread overview] Message-ID: <bug-99588-4-IzGNYc17Av@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-99588-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99588 --- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:b1fc1f1c4b2e9005c40ed476b067577da2d2ce84 commit r10-9619-gb1fc1f1c4b2e9005c40ed476b067577da2d2ce84 Author: Jakub Jelinek <jakub@redhat.com> Date: Fri Mar 19 22:54:31 2021 +0100 c: Fix up -Wunused-but-set-* warnings for _Atomics [PR99588] As the following testcases show, compared to -D_Atomic= case we have many -Wunused-but-set-* warning false positives. When an _Atomic variable/parameter is read, we call mark_exp_read on it in convert_lvalue_to_rvalue, but build_atomic_assign does not. For consistency with the non-_Atomic case where we mark_exp_read the lhs for lhs op= ... but not for lhs = ..., this patch does that too. But furthermore we need to pattern match the trees emitted by _Atomic store, so that _Atomic store itself is not marked as being a variable read, but when the result of the store is used, we mark it. 2021-03-19 Jakub Jelinek <jakub@redhat.com> PR c/99588 * c-typeck.c (mark_exp_read): Recognize what build_atomic_assign with modifycode NOP_EXPR produces and mark the _Atomic var as read if found. (build_atomic_assign): For modifycode of NOP_EXPR, use COMPOUND_EXPRs rather than STATEMENT_LIST. Otherwise call mark_exp_read on lhs. Set TREE_SIDE_EFFECTS on the TARGET_EXPR. * gcc.dg/Wunused-var-5.c: New test. * gcc.dg/Wunused-var-6.c: New test.
next prev parent reply other threads:[~2021-03-30 22:41 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-15 1:53 [Bug c/99588] New: " godmar at gmail dot com 2021-03-15 8:55 ` [Bug c/99588] " rguenth at gcc dot gnu.org 2021-03-16 20:28 ` egallager at gcc dot gnu.org 2021-03-18 11:29 ` jakub at gcc dot gnu.org 2021-03-18 13:14 ` jakub at gcc dot gnu.org 2021-03-19 21:55 ` cvs-commit at gcc dot gnu.org 2021-03-19 21:56 ` jakub at gcc dot gnu.org 2021-03-30 22:41 ` cvs-commit at gcc dot gnu.org [this message] 2021-03-31 6:46 ` jakub at gcc dot gnu.org 2021-04-20 23:33 ` cvs-commit at gcc dot gnu.org 2021-04-22 16:51 ` cvs-commit at gcc dot gnu.org 2021-04-22 17:11 ` jakub at gcc dot gnu.org 2021-09-11 14:24 ` pinskia at gcc dot gnu.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-99588-4-IzGNYc17Av@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).