[Bug c/99588] variable set but not used warning on static _Atomic assignment

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 15 08:55:16 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99588

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu.org
   Last reconfirmed|                            |2021-03-15
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |diagnostic
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
We're likely confused by the "interesting" IL this emits:

;; Function test (null)
;; enabled by -tree-original


{
  static atomic int x = 0;

    static atomic int x = 0;
  printf ((const char * restrict) "%d\n", TARGET_EXPR <D.2476, 1>;
  TARGET_EXPR <D.2477, (int) __atomic_add_fetch_4 ((volatile void *) &x,
(unsigned int) TARGET_EXPR <D.2476, 1>, 5)>;, D.2477);
}

but clearly 'x' is used in the __atomic_add_fetch_4


More information about the Gcc-bugs mailing list