This is the mail archive of the
mailing list for the GCC project.
Re: Optimization of conditional access to globals: thread-unsafe?
> volatile int *v = (int *) 0xdeadbeef;
> int i;
> for (i = 0; i < N; ++i)
> *v = 1;
> _all_ N stores matter. Why? Because v may point to the device I/O
> port, and the device may _count_ those writes among other things.
> But if *v is simply shared, do all stores to it matter? No, only the
> final value is relevant.
Define "final value".