[PATCH v3] Re: avoid useless if-before-free tests
Jim Meyering
jim@meyering.net
Thu Mar 24 16:51:00 GMT 2011
Janne Blomqvist wrote:
> On Tue, Mar 8, 2011 at 19:53, Jim Meyering <jim@meyering.net> wrote:
>> Relative to v2, I've added libgo/ to the list of exempt directories and added
>> this recently discussed gfc_free patch, at the request of Tobias Burnus.
>> Also, I corrected an error in fortran's ChangeLog and removed all
>> whitespace changes from all ChangeLog files.
>
> The libgfortran changes are Ok for 4.7.
>
> For the gfortran frontend (gcc/fortran/*) I'd prefer if you'd
>
> - Replace all calls to "gfc_free (x)" with "free (x)".
> - Remove the gfc_free() function and prototype.
> - Remove the free() macro which currently prevents calling free() directly.
Following up, I've refreshed the series but hit a minor snag
while converting new uses of gfc_free, removing new tests-before-free
and merging/reordering changes.
Applying this fix first makes my problem go away:
>From 77142dc7da9e1e11ef8b0c554df4ff5c1bbdda39 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 24 Mar 2011 17:45:42 +0100
Subject: [PATCH] gfortran: remove unneeded test-before-gfc_free
* trans-openmp.c (gfc_trans_omp_reduction_list): Do not guard
use of gfc_free; it can handle a NULL argument.
---
gcc/fortran/ChangeLog | 5 +++++
gcc/fortran/trans-openmp.c | 3 +--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 4e0a792..c532986 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-24 Jim Meyering <meyering@redhat.com>
+
+ * trans-openmp.c (gfc_trans_omp_reduction_list): Do not guard
+ use of gfc_free; it can handle a NULL argument.
+
2010-03-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/22572
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 53eb999..77ed3bb 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -714,8 +714,7 @@ gfc_trans_omp_array_reduction (tree c, gfc_symbol *sym, locus where)
gfc_free (symtree1);
gfc_free (symtree2);
gfc_free (symtree3);
- if (symtree4)
- gfc_free (symtree4);
+ gfc_free (symtree4);
gfc_free_array_spec (outer_sym.as);
}
--
1.7.4.1.686.g46300
More information about the Java-patches
mailing list