This is the mail archive of the
mailing list for the GCC project.
Re: [Patch,Fortran] PR 42958 - cleanup gfc_call_malloc
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 19 Feb 2010 15:46:06 -0800
- Subject: Re: [Patch,Fortran] PR 42958 - cleanup gfc_call_malloc
- References: <4B7F08A9.email@example.com>
Tobias Burnus wrote:
Dear all,Yes OK,
gfc_call_malloc is used to allocate memory for temporary variables. The
trunk version does first a simple overflow check: If the requested size,
e.g. <array-size>*<sizeof(element)>, is negative (-> overflow) then an
error is printed. For systems with 64bit pointers it does not help and
for 32bit systems, it is also questionable (and not reliable). Thus,
this patch removes this check.
Additionally, this patch makes the malloc-success check optional,
depending on a the new -fcheck=mem check.
I think there is unnecessarily another condition:
size1 = ubound-lbound
size = size1 < 0 ? 0 : size
malloc (MAX(1, size))
the check whether size is "< 0" is not needed. However, the conditional
is created at a different place (gfc_trans_create_temp_array) and as
that function returns "size", it requires some thinking about when one
can get rid of this conditional.
Build and regtested on x86-64-linux. OK for the trunk?
Thanks for patch.