Optimization of conditional access to globals: thread-unsafe?
Eric Botcazou
ebotcazou@libertysurf.fr
Mon Oct 29 08:21:00 GMT 2007
> volatile int *v = (int *) 0xdeadbeef;
>
> void
> f()
> {
> 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".
--
Eric Botcazou
More information about the Gcc
mailing list