http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42112

--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> 2010-11-28 11:17:03 
UTC ---
Tobias,

(In reply to comment #7)
> (In reply to comment #6)
> > One probably needs:
> > 
> > a) If "a" is no TARGET:
> >   deallocate (a)
> >   f(&a)

At present, this is not done.  I guess that it has to be done by the caller,
rather than the callee, simply because of the issue with TARGET below.

> 
> ... which has with -fno-realloc-lhs issues when bound checking is enabled. (I
> do not know whether we should care.)

Surely, we should just not do the deallocate with -fno-realloc-lhs?

> 
> > b) If "a" is a TARGET
> >   f(tmp)
> >   memcpy(a,tmp)
> 
> ... while this one can be optimized with realloc-lhs to a deallocate + pointer
> assignment if the size does not fit (rather than a malloc plus deep copying).

I guess that this makes sense.  It is very easily done.

I'll put this on the TODO list, for fairly early implementation.  I'll see what
I can do with scalars, first.

Paul

Reply via email to