https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109553
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Ever confirmed|0 |1 Last reconfirmed| |2023-04-19 --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- >Both of these functions compile fine with GCC. No GCC has a diagnostic for casa_uint32_t too: <source>: In function 'casa_uint32_t': <source>:13:3: error: passing argument 1 of '__atomic_compare_exchange_4' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 13 | __atomic_compare_exchange_n (a, b, 3, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>:13:3: note: expected 'volatile void *' but argument is of type 'const uint32_t *' {aka 'const unsigned int *'} This is with -pedantic-errors. The C front-end diagnostic by default even. The C++ front-end does not even need -pedantic-errors either: <source>: In function 'void casa_uint32_t(const uint32_t*, uint32_t*, uint32_t*)': <source>:13:32: error: invalid conversion from 'const void*' to 'volatile void*' [-fpermissive] 13 | __atomic_compare_exchange_n (a, b, 3, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); | ^ | | | const void* GCC treats these as normal function calls from the front-end so the warning is an extension even. That is: void f(volatile void*); void g(const void *a) { f(a); } Will gives a similar warning.