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: [PATCH] C undefined behavior fix


<<The dereferencing has _other_ things that can cause it to be undefined (ie
it might not be properly aligned, it might not point to any object at all
etc etc). That's a separate issue.
>>

And there is nothing whatever in the standard to prevent an additionl
implementation defined rule that says that ANY pointer coming from an
integer which is the result of integer arithmetic is not allowed to be
dereferenced. This makes just as much semantic sense as the restrictions
you are comfortable with.

The only reason you are making a distinction is some notion of what happens
at the implementation level, but that's completely out of the semantic
sphere of the standard definition.

You can perfectly well argue that the implementation SHOULD place no further
restrictions on deferencing. That's a reasonable position, very much arguable,
since there are nasty consequences on both sides, but legitimately arguable.

You simply can NOT argue that the standard distinguishes these two csaes
somehow.
\


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