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: question on semantics


On Wed, May 04, 2005 at 01:47:20PM -0600, Chris Friesen wrote:

> Also, what about threads and pthread locking?  Do I need to use volatile 
> there?  If not, then what about using pthread locking between processes?
> 
Same reply I gave you before.  As long as the address of your
shared memory is outside of the function and the pointer is
itself a global variable or gets its value from the heap, then
calls to functions that cannot be inlined will be considered to
clobber dereferences to the pointer.

Things will only break for you when GCC pulls in function bodies
at link time.  At that point, yes, you will need to declare your
pointed-to area as volatile.

If, further down the road we add multithreading semantics to the
optimizers, then you won't need volatile.

> So far I've gotten answers all over the map from people who all claim to 
> know what's going on.  It's a pain.
> 
tree-ssa-alias.c:compute_points_to_and_addr_escape and
tree-ssa-alias.c:compute_may_aliases have the final answer.  I
can guide you through the code if you'd like.


Diego.


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