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: malloc attributes and realloc


Robert Dewar <dewar@gnat.com> writes:

| Gabriel Dos Reis wrote:
| 
| > No, I'm saying that the test
| >     if (*p != 'a')
| > cannot not be "skipped" (or turned into true) because there might be
| > a
| > data there that actually is an 'a'.
| 
| So what?

So, it follows what I wrote:  The transformation is not valid in general.

| The description in the standard is not an operational one, but
| rather an as-if semantic description. 

and we're talking of real algorithms based on pointed-to analysis.

| What possible program semantics
| could be affected by this transformation?

When realloc succeeds, it is guaranteed that the old object is present
in the start of new object (assuming, there is enough room).  That is
not the same for malloc.

-- Gaby


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