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


<<  When casting from pointer to integer and back again, the resulting
  pointer must reference the same object as the original pointer, otherwise
  the behavior is undefined. That is, one may not use integer arithmetic
  to avoid the undefined behavior of pointer arithmetic as proscribed
  in 6.5.6/8.
>>

That seems clear enough to me, and would say clearly that the code in
question *is* undefined. Now Linus appears to claim that the above is
inconsistent with the C standard, but I don't follow his argument that
this is the case (and I do not agree with the conclusion).


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