On Mon, Mar 7, 2016 at 2:34 PM, Marek Polacek <pola...@redhat.com> wrote: > On Fri, Mar 04, 2016 at 07:17:46PM +0100, Uros Bizjak wrote: >> Hello! >> >> > This is not a regression but I thought I'd post this anyway. Martin >> > reported >> > that we generate -Wunused-value warnings on the attached testcase, which >> > arguable doesn't make sense. Setting TREE_USED suppresses the warning. >> > Since >> > we already compute 'fetch_op' I used that. (This warning doesn't trigger >> > e.g. >> > for __atomic_load/store/compare.) >> > >> > Bootstrapped/regtested on x86_64-linux, ok for trunk or gcc7? >> > >> > 2016-03-04 Marek Polacek <pola...@redhat.com> >> > >> > PR c/69407 >> > * c-common.c (resolve_overloaded_builtin): Set TREE_USED for the fetch >> > operations. >> > >> > * gcc.dg/atomic-op-6.c: New test. >> >> You can probably revert my workaround [1] that suppressed these >> warnings in libsupc++/guard.cc. > > Ah, thanks for the heads-up, I'll do that once I get the patch in.
I have committed the attached revert after bootstrap on x86_64-linux-gnu {,-m32}. There were no warnings when compiling guard.cc. 2016-03-18 Uros Bizjak <ubiz...@gmail.com> Revert: 2015-07-02 Uros Bizjak <ubiz...@gmail.com> * libsupc++/guard.cc (__test_and_acquire): Use __p after __atomic_load to avoid unused variable warning. (__set_and_release): Use __p after __atomic_store to avoid unused variable warning. Uros.
Index: libsupc++/guard.cc =================================================================== --- libsupc++/guard.cc (revision 234330) +++ libsupc++/guard.cc (working copy) @@ -117,7 +117,6 @@ __test_and_acquire (__cxxabiv1::__guard *g) unsigned char __c; unsigned char *__p = reinterpret_cast<unsigned char *>(g); __atomic_load (__p, &__c, __ATOMIC_ACQUIRE); - (void) __p; return _GLIBCXX_GUARD_TEST(&__c); } # define _GLIBCXX_GUARD_TEST_AND_ACQUIRE(G) __test_and_acquire (G) @@ -133,7 +132,6 @@ __set_and_release (__cxxabiv1::__guard *g) unsigned char *__p = reinterpret_cast<unsigned char *>(g); unsigned char val = 1; __atomic_store (__p, &val, __ATOMIC_RELEASE); - (void) __p; } # define _GLIBCXX_GUARD_SET_AND_RELEASE(G) __set_and_release (G) # endif