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: PR 25512: pointer overflow defined?


Robert Dewar <dewar@adacore.com> writes:

| Richard Guenther wrote:
| 
| >The problem in this PR is that code like in the testcase (from OpenOffice)
| >assumes that pointer overflow is defined.  As the standard does not talk
| >about wrapping pointer semantics at all (at least I couldn't find anything
| >about that), how should we treat this?
| >
| How could pointer arithmetic overflow, the result must be within the
| same allocated object (or just past it in the array case, and if necessary

It highly depends on what you define to be pointer arithmetic.

Given the conversions

   pointer -> integer type
   integer type -> pointer
   T* -> U*
  
I think your sentence is way to restrictive and does not capture C
models.

Richard, to resolve this issue, we need to be more precise about our
mappings for

   pointer -> integer type
   integer type -> pointer
   T* -> U*

conversions.  This is not an issue to resolved in isolation, piece meal.

-- Gaby


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