[patch, fortran] PR 54833 Don't wrap calls to free(a) in if (a != NULL)

Thomas Koenig tkoenig@netcologne.de
Sat Oct 6 11:22:00 GMT 2012


I wrote:

> the attached patch removes wrapping calls to free(a) by
> if (a != NULL) for some cases.  It is not complete, because
> automatic deallocation of allocatable structure components
> is not yet covered.

I accidentally posted an old version, which had a bug in
coarrays (basically was just missing an "else").  Regression-tested.

OK for trunk?

	Thomas

2012-10-06  Thomas König  <tkoenig@gcc.gnu.org>

         PR fortran/54833
         * trans.c (gfc_call_free):  Do not wrap the
         call to __builtin_free in check for NULL.
         (gfc_deallocate_with_status): For automatic deallocation without
         status for non-coarrays, don't wrap call to __builtin_free in
         check for NULL.

2012-10-06  Thomas König  <tkoenig@gcc.gnu.org>

         PR fortran/54833
         * gfortran.dg/auto_dealloc_3.f90:  New test.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: p3.diff
Type: text/x-patch
Size: 2381 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20121006/ee97d8e4/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: auto_dealloc_3.f90
Type: text/x-fortran
Size: 349 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20121006/ee97d8e4/attachment-0001.bin>


More information about the Fortran mailing list