https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120268
--- Comment #5 from Kael Franco <kaelfandrew at gmail dot com> --- (In reply to Kael Franco from comment #4) > (In reply to Andrew Pinski from comment #1) > > This is only valid with -fallow-store-data-races. Otherwise you can > > introduce a race condition according to the C/C++11 memory model. > > I don't think -fallow-store-data-races is needed if the pointer was restrict > or TYPE_QUAL_RESTRICT in GCC's tree: > > ``` > void f0(int * restrict arg0){ > if(arg0[0]) > arg0[0] = 0; > } > ``` Actually nevermind since restrict isn't a threading locking mechanism.