On Tue, 16 Jun 2020, Jonathan Wakely via Gcc-patches wrote: > Currently the __atomic_{load,store,exchange,compare_exchange} built-ins > will happily store values through pointers to const, or use pointers to > volatile as the input and output arguments. This patch ensures that any > pointer that will be written through does not point to a const object, > and only the pointer to the atomic variable can be volatile. > > This differs slightly from Clang, which allows the third argument to > __atomic_exchange (the one that is used to return the old value) to be > volatile if and only if the first argument is volatile. That doesn't > seem useful. > > For C++ emit errors, but for C use pedwarns that are controlled by > -Wincompatible-pointer-types. > > gcc/c-family/ChangeLog: > > * c-common.c (get_atomic_generic_size): Check cv-qualifiers in > pointer arguments. > > gcc/testsuite/ChangeLog: > > * c-c++-common/pr95378.c: New test. > > > Tested powerpc64le-linux. > > OK for master?
OK. -- Joseph S. Myers jos...@codesourcery.com