Dear all,
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?