PR 25512: pointer overflow defined?

Richard Guenther rguenther@suse.de
Wed Dec 21 13:27:00 GMT 2005


On Wed, 21 Dec 2005, Andrew Haley wrote:

> Richard Guenther writes:
>  > 
>  > 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?
> 
> Look at Section 6.5.6, Para 8.  The code is undefined.

This talks about pointers that point to elements of an array object.
It does not talk about doing arithmetic on arbitrary pointer (constants),
which is what the code does.  Or is a pointer always pointing to elements
of some array object (being it the global heap "array object")?

Richard. 



More information about the Gcc mailing list