[PATCH] PR fortran/95826 - Buffer overflows with PDTs and long symbols

Harald Anlauf anlauf@gmx.de
Wed Jun 24 17:25:20 GMT 2020


Hi Thomas,

> Is the memory you allocate freed anywhere?  We have a large
> number of memory leaks in the front end, but maybe we shouldn't
> add another one :-)

my reading of the definition of XALLOCAVEC

include/libiberty.h:#define XALLOCAVEC(T, N)    ((T *) alloca (sizeof (T) * (N)))

and alloca(3):

ALLOCA(3)                       Linux Programmer's Manual                      ALLOCA(3)

NAME
       alloca - allocate memory that is automatically freed

told me to ignore questions like your's.  OK, I didn't.

Well, the pointer (char *name) is local and does not escape,
so I presumed that this is the way to go.

Anybody who knows better please correct me.  The above should be
mapped to a gcc builtin anyway.

Thanks,
Harald



More information about the Gcc-patches mailing list