This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Optimization of conditional access to globals: thread-unsafe?


>   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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]