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]

'restrict': C9X vs C99


When 'restrict' was implemented in GCC, the public C9X drafts gave it
'unique access' semantics: the only access to an object accessed through a
restricted pointer was through that pointer.  In C99 this changed to 'one
writer or many readers': if an object is accessed through a restricted
pointer and is also somehow modified then all access is through that
pointer, but unmodified objects may be aliased.

Which semantics are currently implemented in GCC, and does it make any
difference?  (In particular, is code written to the C99 semantics safe
with GCC?)  I would guess that aliasing of read-only objects shouldn't
cause problems as long as alias information doesn't escape from the scope
of the restricted pointer, but perhaps an alias analysis expert could
comment?

-- 
Joseph S. Myers
jsm28@cam.ac.uk


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