This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: Avoid calls to realloc for nvptx


On Wed, Oct 22, 2014 at 10:58:32AM +0200, Thomas Schwinge wrote:
> So, something in spirit of what has been implemented in
> gcc/config/i386/gmm_malloc.h.

Yeah, though don't take that literally, gmm_malloc.h e.g. isn't very secure,
_mm_malloc (-16384, 32768);
might very well result in heap corruption already by the inline function, or
by the caller, even when the malloc inside
of it actually allocated just 16384 bytes.

There should be:
  if (size >= -align)
    {
      errno = ENOMEM;
      return (void *) 0;
    }
before the malloc call.

	Jakub


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