public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: avoid useless if-before-free tests
       [not found] <87zkp9zmq0.fsf@rho.meyering.net>
@ 2011-03-05 19:16 ` Joseph S. Myers
  2011-03-07 19:52   ` Dr Andrew John Hughes
                     ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Joseph S. Myers @ 2011-03-05 19:16 UTC (permalink / raw)
  To: Jim Meyering; +Cc: gcc-patches, java-patches

On Sat, 5 Mar 2011, Jim Meyering wrote:

> diff --git a/gcc/config/i386/gmm_malloc.h b/gcc/config/i386/gmm_malloc.h
> index 7a7e840..8993fc7 100644
> --- a/gcc/config/i386/gmm_malloc.h
> +++ b/gcc/config/i386/gmm_malloc.h
> @@ -67,8 +67,7 @@ _mm_malloc (size_t size, size_t align)
>  static __inline__ void
>  _mm_free (void * aligned_ptr)
>  {
> -  if (aligned_ptr)
> -    free (((void **) aligned_ptr) [-1]);
> +  free (((void **) aligned_ptr) [-1]);
>  }

This one looks suspicious; it's not if (p) free (p); but if (p) free 
(something-derived-from-p);.

> diff --git a/libjava/classpath/native/fdlibm/dtoa.c b/libjava/classpath/native/fdlibm/dtoa.c
> index 458e629..92aa793 100644

http://gcc.gnu.org/codingconventions.html says Classpath changes should go 
via Classpath upstream, not directly into GCC.  I don't know if that's 
still accurate.

> diff --git a/zlib/contrib/minizip/unzip.c b/zlib/contrib/minizip/unzip.c
> index 9ad4766..644ef1b 100644

We definitely don't want to make local changes to zlib for this sort of 
issue, though importing a new upstream version of zlib (making sure the 
local configure code still works) should be fine for 4.7.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: avoid useless if-before-free tests
  2011-03-05 19:16 ` avoid useless if-before-free tests Joseph S. Myers
@ 2011-03-07 19:52   ` Dr Andrew John Hughes
  2011-03-07 22:47     ` Joseph S. Myers
  2011-03-08 10:45   ` Jim Meyering
  2011-03-08 14:21   ` [PATCH v2] " Jim Meyering
  2 siblings, 1 reply; 31+ messages in thread
From: Dr Andrew John Hughes @ 2011-03-07 19:52 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Jim Meyering, gcc-patches, java-patches

On 19:16 Sat 05 Mar     , Joseph S. Myers wrote:
> On Sat, 5 Mar 2011, Jim Meyering wrote:
> 
> > diff --git a/gcc/config/i386/gmm_malloc.h b/gcc/config/i386/gmm_malloc.h
> > index 7a7e840..8993fc7 100644
> > --- a/gcc/config/i386/gmm_malloc.h
> > +++ b/gcc/config/i386/gmm_malloc.h
> > @@ -67,8 +67,7 @@ _mm_malloc (size_t size, size_t align)
> >  static __inline__ void
> >  _mm_free (void * aligned_ptr)
> >  {
> > -  if (aligned_ptr)
> > -    free (((void **) aligned_ptr) [-1]);
> > +  free (((void **) aligned_ptr) [-1]);
> >  }
> 
> This one looks suspicious; it's not if (p) free (p); but if (p) free 
> (something-derived-from-p);.
> 
> > diff --git a/libjava/classpath/native/fdlibm/dtoa.c b/libjava/classpath/native/fdlibm/dtoa.c
> > index 458e629..92aa793 100644
> 
> http://gcc.gnu.org/codingconventions.html says Classpath changes should go 
> via Classpath upstream, not directly into GCC.  I don't know if that's 
> still accurate.
> 

That's still true.  This seems to be the first message I've received in this
thread, so I'm not even aware of what these changes are.  Were the earlier
messages not sent to this list?

> > diff --git a/zlib/contrib/minizip/unzip.c b/zlib/contrib/minizip/unzip.c
> > index 9ad4766..644ef1b 100644
> 
> We definitely don't want to make local changes to zlib for this sort of 
> issue, though importing a new upstream version of zlib (making sure the 
> local configure code still works) should be fine for 4.7.
> 
> -- 
> Joseph S. Myers
> joseph@codesourcery.com

-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and IcedTea
http://www.gnu.org/software/classpath
http://icedtea.classpath.org
PGP Key: F5862A37 (https://keys.indymedia.org/)
Fingerprint = EA30 D855 D50F 90CD F54D  0698 0713 C3ED F586 2A37

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: avoid useless if-before-free tests
  2011-03-07 19:52   ` Dr Andrew John Hughes
@ 2011-03-07 22:47     ` Joseph S. Myers
  2011-03-08 16:57       ` Dr Andrew John Hughes
  0 siblings, 1 reply; 31+ messages in thread
From: Joseph S. Myers @ 2011-03-07 22:47 UTC (permalink / raw)
  To: Dr Andrew John Hughes; +Cc: Jim Meyering, gcc-patches, java-patches

On Mon, 7 Mar 2011, Dr Andrew John Hughes wrote:

> > http://gcc.gnu.org/codingconventions.html says Classpath changes should go 
> > via Classpath upstream, not directly into GCC.  I don't know if that's 
> > still accurate.
> > 
> 
> That's still true.  This seems to be the first message I've received in this
> thread, so I'm not even aware of what these changes are.  Were the earlier
> messages not sent to this list?

The original patch went only to gcc-patches.

http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00252.html

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: avoid useless if-before-free tests
  2011-03-05 19:16 ` avoid useless if-before-free tests Joseph S. Myers
  2011-03-07 19:52   ` Dr Andrew John Hughes
@ 2011-03-08 10:45   ` Jim Meyering
  2011-03-08 14:21   ` [PATCH v2] " Jim Meyering
  2 siblings, 0 replies; 31+ messages in thread
From: Jim Meyering @ 2011-03-08 10:45 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: gcc-patches, java-patches

Joseph S. Myers wrote:

Thank you for the prompt feedback.

> On Sat, 5 Mar 2011, Jim Meyering wrote:
>
>> diff --git a/gcc/config/i386/gmm_malloc.h b/gcc/config/i386/gmm_malloc.h
>> index 7a7e840..8993fc7 100644
>> --- a/gcc/config/i386/gmm_malloc.h
>> +++ b/gcc/config/i386/gmm_malloc.h
>> @@ -67,8 +67,7 @@ _mm_malloc (size_t size, size_t align)
>>  static __inline__ void
>>  _mm_free (void * aligned_ptr)
>>  {
>> -  if (aligned_ptr)
>> -    free (((void **) aligned_ptr) [-1]);
>> +  free (((void **) aligned_ptr) [-1]);
>>  }
>
> This one looks suspicious; it's not if (p) free (p); but if (p) free
> (something-derived-from-p);.

Good catch.  That is an invalid transformation.  I've reverted it.
It is also the first one like that that I've seen.
Calling free (((void **) 0) [-1]); would not go down well.

>> diff --git a/libjava/classpath/native/fdlibm/dtoa.c
>> b/libjava/classpath/native/fdlibm/dtoa.c
>> index 458e629..92aa793 100644
>
> http://gcc.gnu.org/codingconventions.html says Classpath changes should go
> via Classpath upstream, not directly into GCC.  I don't know if that's
> still accurate.

Thanks for the tip and for Cc'ing java-patches.
I've omitted the classpath/ changes.

>> diff --git a/zlib/contrib/minizip/unzip.c b/zlib/contrib/minizip/unzip.c
>> index 9ad4766..644ef1b 100644
>
> We definitely don't want to make local changes to zlib for this sort of
> issue, though importing a new upstream version of zlib (making sure the
> local configure code still works) should be fine for 4.7.

I've also omitted zlib/ and intl/ changes.

Is libgo/ in the same boat?  Only one of its files is affected, but
I found no ChangeLog for libgo and no libgo-related ChangeLog entries.
I could always add an entry at the top,

   * libgo/runtime/go-select.c (__go_select): ...

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH v2] Re: avoid useless if-before-free tests
  2011-03-05 19:16 ` avoid useless if-before-free tests Joseph S. Myers
  2011-03-07 19:52   ` Dr Andrew John Hughes
  2011-03-08 10:45   ` Jim Meyering
@ 2011-03-08 14:21   ` Jim Meyering
  2011-03-08 14:30     ` Rainer Orth
  2011-03-08 17:54     ` [PATCH v3] " Jim Meyering
  2 siblings, 2 replies; 31+ messages in thread
From: Jim Meyering @ 2011-03-08 14:21 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: gcc-patches, java-patches

Joseph S. Myers wrote:
...
> We definitely don't want to make local changes to zlib for this sort of
> issue, though importing a new upstream version of zlib (making sure the
> local configure code still works) should be fine for 4.7.

Thanks again for the feedback.
I've omitted changes to the intl/, zlib/ and classpath/ directories
reverted the problem you spotted, and added ChangeLog entries.

Also, rather than simply removing the "free and realloc" section
in README.Portability, I've replaced it with some explanation.

I've taken the liberty of letting my editor remove trailing
blanks in ChangeLog files.  I hope that's ok.  Also in ChangeLogs,
I converted some leading 8-space (and 7-space) sequences to single TABs.

I found no ChangeLog for libgo and no other libgo-related entries.
I suspect that means I should omit this change because it belongs upstream.
For now, I've added an entry in the top-level ChangeLog file:
 * libgo/runtime/go-select.c (__go_select):
It's easier to remove than to add.

Finally, I've rebased this series to apply to the latest on "master",
plus the memory overrun fix I just posted.

Re testing, I confirmed that the output of "make check" is essentially
the same with and without these changes.  The only differences were
due to embedded dates and different ordering due to my use of
parallel make.

From 0d18b70a8821ab2fc58b5ed592ed611e05a29c7f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Mon, 3 Jan 2011 16:52:37 +0100
Subject: [PATCH 1/2] discourage unnecessary use of if before free

* README.Portability: Explain why "if (P) free (P)" is best avoided.
---
 gcc/README.Portability |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/gcc/README.Portability b/gcc/README.Portability
index 32a33e2..e099a3f 100644
--- a/gcc/README.Portability
+++ b/gcc/README.Portability
@@ -51,14 +51,24 @@ foo (bar, )
 needs to be coded in some other way.


-free and realloc
-----------------
+Avoid unnecessary test before free
+----------------------------------

-Some implementations crash upon attempts to free or realloc the null
-pointer.  Thus if mem might be null, you need to write
+Since SunOS 4 stopped being a reasonable portability target,
+(which happened around 2007) there has been no need to guard
+against "free (NULL)".  Thus, any guard like the following
+constitutes a redundant test:

-  if (mem)
-    free (mem);
+  if (P)
+    free (P);
+
+It is better to avoid the test.[*]
+Instead, simply free P, regardless of whether it is NULL.
+
+[*] However, if your profiling exposes a test like this in a
+performance-critical loop, say where P is nearly always NULL, and
+the cost of calling free on a NULL pointer would be prohibitively
+high, please let us know.


 Trigraphs
@@ -194,4 +204,3 @@ o Passing incorrect types to fprintf and friends.

 o Adding a function declaration for a module declared in another file to
   a .c file instead of to a .h file.
-
--
1.7.4.1.299.ga459d


From 47219806715ee0f88f27df95fa99ee436d001358 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Tue, 8 Mar 2011 12:19:24 +0100
Subject: [PATCH 2/2] remove useless if-before-free tests

Change "if (E) free (E);" to "free (E);" everywhere
except in the intl/, zlib/ and classpath/ directories.
Also transform equivalent variants like
"if (E != NULL) free (E);" and allow an extra cast on the
argument to free.  Otherwise, the tested and freed "E"
expressions must be identical, modulo white space.
---
 ChangeLog                           |   23 ++++---
 gcc/ChangeLog                       |   39 ++++++++++
 gcc/ada/ChangeLog                   |    8 ++-
 gcc/ada/initialize.c                |    3 +-
 gcc/c-family/ChangeLog              |  133 ++++++++++++++++++-----------------
 gcc/c-family/c-format.c             |    6 +-
 gcc/calls.c                         |   15 ++---
 gcc/cfgcleanup.c                    |    3 +-
 gcc/collect2.c                      |    3 +-
 gcc/config/i386/i386.c              |    3 +-
 gcc/config/mcore/mcore.c            |    3 +-
 gcc/coverage.c                      |    3 +-
 gcc/cp/ChangeLog                    |    4 +
 gcc/cp/tree.c                       |    3 +-
 gcc/cse.c                           |    6 +-
 gcc/cselib.c                        |    3 +-
 gcc/df-core.c                       |   15 ++---
 gcc/fortran/ChangeLog               |    5 ++
 gcc/fortran/gfortranspec.c          |    5 +-
 gcc/function.c                      |    3 +-
 gcc/gcc.c                           |   15 ++---
 gcc/gcov.c                          |    6 +-
 gcc/gensupport.c                    |   12 +--
 gcc/graphite-clast-to-gimple.c      |    3 +-
 gcc/graphite-sese-to-poly.c         |    3 +-
 gcc/haifa-sched.c                   |    3 +-
 gcc/ipa-prop.c                      |    3 +-
 gcc/ipa-pure-const.c                |    3 +-
 gcc/ipa-reference.c                 |    3 +-
 gcc/ira-costs.c                     |   15 ++---
 gcc/ira.c                           |    9 +--
 gcc/java/ChangeLog                  |  126 +++++++++++++++++----------------
 gcc/java/jcf-parse.c                |    3 +-
 gcc/matrix-reorg.c                  |    9 +--
 gcc/prefix.c                        |    3 +-
 gcc/profile.c                       |    3 +-
 gcc/reload1.c                       |   12 +--
 gcc/sched-deps.c                    |    3 +-
 gcc/sel-sched-ir.c                  |    3 +-
 gcc/sese.c                          |    6 +-
 gcc/tree-data-ref.c                 |    6 +-
 gcc/tree-eh.c                       |    3 +-
 gcc/tree-ssa-coalesce.c             |    3 +-
 gcc/tree-ssa-live.c                 |    6 +-
 gcc/tree-ssa-loop-ivopts.c          |    6 +-
 gcc/tree-ssa-pre.c                  |    3 +-
 libcpp/ChangeLog                    |   19 ++++--
 libcpp/files.c                      |    3 +-
 libcpp/init.c                       |    3 +-
 libcpp/macro.c                      |    3 +-
 libcpp/pch.c                        |    9 +--
 libdecnumber/ChangeLog              |   29 +++++---
 libdecnumber/decNumber.c            |   80 +++++++++++-----------
 libgfortran/ChangeLog               |   12 ++-
 libgfortran/intrinsics/move_alloc.c |    3 +-
 libgfortran/io/fbuf.c               |    3 +-
 libgfortran/io/format.c             |    3 +-
 libgfortran/io/open.c               |    3 +-
 libgfortran/io/unit.c               |    9 +--
 libgfortran/io/unix.c               |    3 +-
 libgo/runtime/go-select.c           |    6 +-
 libiberty/ChangeLog                 |   41 +++++++----
 libiberty/cp-demint.c               |    6 +-
 libiberty/cplus-dem.c               |   13 +---
 libiberty/pex-common.c              |    9 +--
 libiberty/pex-msdos.c               |    6 +-
 libiberty/pex-win32.c               |   24 ++----
 libiberty/regex.c                   |   11 +--
 libiberty/spaces.c                  |    5 +-
 libstdc++-v3/ChangeLog              |    5 ++
 libstdc++-v3/libsupc++/del_opnt.cc  |    3 +-
 lto-plugin/ChangeLog                |   18 +++--
 lto-plugin/lto-plugin.c             |    6 +-
 73 files changed, 440 insertions(+), 451 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c736190..99c572c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* libgo/runtime/go-select.c (__go_select): Remove useless
+	if-before-free test.
+
 2011-03-06  Joey Ye  <joey.ye@arm.com>

 	* MAINTAINERS: Update my e-mail address.
@@ -825,11 +830,11 @@
 	* configure: Regenerate.

 2010-01-07  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
-            Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+	    Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

 	PR bootstrap/42424
 	* configure.ac: Include libtool m4 files.
-        (_LT_CHECK_OBJDIR): Call it.
+	(_LT_CHECK_OBJDIR): Call it.
 	(extra_mpc_mpfr_configure_flags, extra_mpc_gmp_configure_flags,
 	gmplibs, ppllibs, clooglibs): Use $lt_cv_objdir.

@@ -970,7 +975,7 @@

 2009-10-26  Johannes Singler  <singler@kit.edu>

-        * MAINTAINERS (Write After Approval): Update my e-mail address.
+	* MAINTAINERS (Write After Approval): Update my e-mail address.

 2009-10-23  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

@@ -1006,7 +1011,7 @@
 2009-10-07  Rafael Avila de Espindola  <espindola@google.com>

 	* MAINTAINERS: Change my email address. Change plugi-in to plugin.
-	
+
 2009-10-07  Richard Guenther  <rguenther@suse.de>

 	* MAINTAINERS (LTO): List Diego Novillo, Rafael Avila de Espindola,
@@ -1258,7 +1263,7 @@

 	* configure.ac (sh*-*-elf): Don't add target-libgloss to noconfigdirs.
 	* configure: Regenerate.
-	
+
 2009-07-28  Rask Ingemann Lambertsen  <ccc94453@vip.cybercity.dk>

 	* MAINTAINERS (Write After Approval): Update my e-mail address.
@@ -1323,7 +1328,7 @@

 2009-06-09  Ghassan Shobaki  <ghassan.shobaki@amd.com>

-        * MAINTAINERS: Added my name to the write-after-approval list
+	* MAINTAINERS: Added my name to the write-after-approval list

 2009-06-08  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

@@ -1333,8 +1338,8 @@
 2009-06-03  Jerome Guitton  <guitton@adacore.com>
 	    Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

-        * Makefile.tpl (all): Avoid a trailing backslash.
-        * Makefile.in: Regenerate.
+	* Makefile.tpl (all): Avoid a trailing backslash.
+	* Makefile.in: Regenerate.

 2009-06-03  Ben Elliston  <bje@au.ibm.com>

@@ -1550,7 +1555,7 @@
 2009-03-11  Nicola Pero  <nicola.pero@meta-innovation.com>

 	* MAINTAINERS: Update e-mail address.
-	
+
 2009-03-11  Dorit Nuzman  <dorit@il.ibm.com>

 	* MAINTAINERS: Remove myself as auto-vectorizer maintainer.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ece9ec1..520924b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,42 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	Remove useless if-before-free tests.
+	* calls.c (expand_call, save_area): Likewise.
+	* cfgcleanup.c (try_forward_edges): Likewise.
+	* collect2.c (collect_execute): Likewise.
+	* config/i386/i386.c (ix86_valid_target_attribute_tree): Likewise.
+	* config/mcore/mcore.c (mcore_expand_prolog): Likewise.
+	* coverage.c (coverage_checksum_string): Likewise.
+	* cse.c (init_cse_reg_info, delete_trivially_dead_insns): Likewise.
+	* cselib.c (cselib_init): Likewise.
+	* df-core.c (rest_of_handle_df_finish, df_analyze): Likewise.
+	(df_set_clean_cfg): Likewise.
+	* function.c (free_after_compilation): Likewise.
+	* gcc.c (do_spec_1, main): Likewise.
+	* gcov.c (create_file_names): Likewise.
+	* gensupport.c (identify_predicable_attribute): Likewise.
+	* graphite-clast-to-gimple.c (save_clast_name_index): Likewise.
+	* graphite-sese-to-poly.c (free_data_refs_aux): Likewise.
+	* haifa-sched.c (haifa_finish_h_i_d): Likewise.
+	* ipa-prop.c (ipa_free_node_params_substructures): Likewise.
+	* ipa-pure-const.c (local_pure_const): Likewise.
+	* ipa-reference.c (propagate): Likewise.
+	* ira-costs.c (free_ira_costs): Likewise.
+	* ira.c (free_register_move_costs, build_insn_chain): Likewise.
+	* matrix-reorg.c (mat_free): Likewise.
+	* prefix.c (get_key_value): Likewise.
+	* profile.c (compute_value_histograms): Likewise.
+	* reload1.c (free_reg_equiv): Likewise.
+	* sched-deps.c (free_deps): Likewise.
+	* sel-sched-ir.c (fence_clear): Likewise.
+	* sese.c (set_rename, if_region_set_false_region): Likewise.
+	* tree-data-ref.c (free_rdg): Likewise.
+	* tree-eh.c (lower_try_finally): Likewise.
+	* tree-ssa-coalesce.c (delete_coalesce_list): Likewise.
+	* tree-ssa-live.c (delete_var_map): Likewise.
+	* tree-ssa-loop-ivopts.c (free_loop_data): Likewise.
+	* tree-ssa-pre.c (phi_trans_add): Likewise.
+
 2011-03-08  Jakub Jelinek  <jakub@redhat.com>

 	PR tree-optimization/48022
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index defad83..fa56f88 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* initialize.c (__gnat_initialize): Remove useless if-before-free.
+
 2011-02-14  Eric Botcazou  <ebotcazou@adacore.com>

 	* gcc-interface/misc.c (gnat_init_options): Do not concatenate -I and
@@ -39,7 +43,7 @@
 	dependency.

 2011-01-04  Pascal Obry  <obry@adacore.com>
-            Eric Botcazou  <ebotcazou@adacore.com>
+	    Eric Botcazou  <ebotcazou@adacore.com>

 	* gcc-interface/decl.c: Disable Stdcall convention handling for 64-bit.

@@ -55,7 +59,7 @@
 	the CICO mechanism.

 2011-01-04  Olivier Hainque  <hainque@adacore.com>
-            Eric Botcazou  <ebotcazou@adacore.com>
+	    Eric Botcazou  <ebotcazou@adacore.com>

 	* gcc-interface/trans.c (BLOCK_SOURCE_END_LOCATION): Provide default.
 	(set_end_locus_from_node): New function.
diff --git a/gcc/ada/initialize.c b/gcc/ada/initialize.c
index 32ea0e5..e2ad904 100644
--- a/gcc/ada/initialize.c
+++ b/gcc/ada/initialize.c
@@ -217,8 +217,7 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)

 		     FindClose (hDir);

-		     if (dir != NULL)
-		       free (dir);
+		     free (dir);
 		   }
 	       }
 	     else
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 60fc08f..c0b7ae6 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* c-format.c (init_dollar_format_checking): Remove useless
+	if-before-free.
+
 2011-03-07  Nathan Froyd  <froydnj@codesourcery.com>

 	PR c/47786
@@ -69,7 +74,7 @@
 2010-12-18  Nicola Pero  <nicola.pero@meta-innovation.com>

 	* c-objc.h (objc_maybe_warn_exceptions): New.
-	* stub-objc.c (objc_maybe_warn_exceptions): New.	
+	* stub-objc.c (objc_maybe_warn_exceptions): New.

 2010-12-10  Nathan Froyd  <froydnj@codesourcery.com>

@@ -96,7 +101,7 @@
 	* stub-objc.c (objc_finish_function): New.
 	(objc_non_volatilized_type): Removed.
 	(objc_type_quals_match): Removed.
-	
+
 2010-11-30  Joseph Myers  <joseph@codesourcery.com>

 	* c-common.h (parse_optimize_options): Declare.
@@ -173,7 +178,7 @@

 	* c-common.h (objc_declare_protocols): Added additional argument.
 	* stub-objc.c (objc_declare_protocol): Same change.
-	
+
 2010-11-18  Nathan Froyd  <froydnj@codesourcery.com>

 	PR c/33193
@@ -253,7 +258,7 @@
 	* c-format.c (format_type): New type gcc_objc_string_format_type.
 	(valid_stringptr_type_p): New.
 	(handle_format_arg_attribute): Use valid_stringptr_type_p ().
-	(check_format_string): Pass expected type, use 
+	(check_format_string): Pass expected type, use
 	valid_stringptr_type_p (), check that the format string types are
 	consistent with the format specification.
 	(decode_format_attr): Warn if NSString is used outside objective-c.
@@ -270,7 +275,7 @@

 2010-11-04  Nicola Pero  <nicola.pero@meta-innovation.com>

-	Fixed using the Objective-C 2.0 dot-syntax with class names.	
+	Fixed using the Objective-C 2.0 dot-syntax with class names.
 	* c-common.h (objc_build_class_component_ref): New.
 	* stub-objc.c (objc_build_class_component_ref): New.

@@ -294,6 +299,14 @@
 	* c-common.c (conversion_warning, warn_for_collisions_1): Use
 	EXPR_LOC_OR_HERE.

+2010-10-29  Arnaud Charlet  <charlet@adacore.com>
+	    Matthew Gingell  <gingell@adacore.com>
+
+	* c-ada-spec.c (separate_class_package): New function.
+	(pp_ada_tree_identifier): Prefix references to C++ classes with the
+	name of their enclosing package.
+	(print_ada_declaration): Use separate_class_package.
+
 2010-10-30  Nicola Pero  <nicola.pero@meta-innovation.com>

 	Implemented Objective-C 2.0 @property, @synthesize and @dynamic.
@@ -311,14 +324,6 @@
 	objc_maybe_build_component_ref.
 	(objc_build_setter_call): Renamed to objc_maybe_build_modify_expr.
 	(objc_is_property_ref): New.
-	
-2010-10-29  Arnaud Charlet  <charlet@adacore.com>
-	    Matthew Gingell  <gingell@adacore.com>
-
-	* c-ada-spec.c (separate_class_package): New function.
-	(pp_ada_tree_identifier): Prefix references to C++ classes with the
-	name of their enclosing package.
-	(print_ada_declaration): Use separate_class_package.

 2010-10-27  Jason Merrill  <jason@redhat.com>

@@ -327,6 +332,17 @@

 	* c-common.c (check_case_value): Remove special C++ code.

+2010-10-23  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+	* c-common.h (objc_maybe_printable_name): New.
+	* stub-objc.c (objc_maybe_printable_name): New.
+
+2010-10-27  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+	* c-common.h (objc_add_property_variable): Renamed to
+	objc_add_property_declaration.  Added location argument.
+	* stub-objc.c (objc_add_property_variable): Same change.
+
 2010-10-27  Nicola Pero  <nicola.pero@meta-innovation.com>

 	* c-common.h (enum rid): Added RID_READWRITE, RID_ASSIGN,
@@ -340,17 +356,6 @@
 	* stub-objc.c (objc_add_property_declaration): Added additional
 	arguments.
 	(objc_set_property_attr): Removed.
-	
-2010-10-27  Nicola Pero  <nicola.pero@meta-innovation.com>
-
-	* c-common.h (objc_add_property_variable): Renamed to
-	objc_add_property_declaration.  Added location argument.
-	* stub-objc.c (objc_add_property_variable): Same change.
-	
-2010-10-23  Nicola Pero  <nicola.pero@meta-innovation.com>
-
-	* c-common.h (objc_maybe_printable_name): New.
-	* stub-objc.c (objc_maybe_printable_name): New.

 2010-10-22  Artjoms Sinkarovs <artyom.shinakroff@gmail.com>
 	Andrew Pinski <pinskia@gmail.com>
@@ -369,31 +374,15 @@
 	(objc_start_method_definition): Same change.
 	(objc_build_method_signature): Same change.

-2010-10-20  Nicola Pero  <nicola.pero@meta-innovation.com>
+2010-10-17  Nicola Pero  <nicola.pero@meta-innovation.com>

-	* c-common.h (finish_file): Removed.
-	(objc_write_global_declarations): New.
-	* c-opts.c (c_common_parse_file): Do not call finish_file.
-	* stub-objc.c (objc_write_global_declarations): New.
-	
-2010-10-18  Nicola Pero  <nicola.pero@meta-innovation.com>
+	Merge from 'apple/trunk' branch on FSF servers.

-	Implemented parsing @synthesize and @dynamic for
-	Objective-C/Objective-C++.
-	* c-common.h (enum rid): Add RID_AT_SYNTHESIZE and RID_AT_DYNAMIC.
-	(objc_add_synthesize_declaration): New.
-	(objc_add_dynamic_declaration): New.
-	* c-common.c (c_common_reswords): Add synthesize and dynamic.
-	* stub-objc.c (objc_add_synthesize_declaration): New.
-	(objc_add_dynamic_declaration): New.
-	
-2010-10-18  Michael Meissner  <meissner@linux.vnet.ibm.com>
+	2006-03-27 Fariborz Jahanian <fjahanian@apple.com>

-	PR target/46041
-	* c-cppbuiltin.c (mode_has_fma): Move function here from
-	builtins.c.  Don't use the fma optab, instead just use the
-	HAVE_fma* macros, so that __FP_FAST_FMA* will be defined when
-	using -save-temps.
+	Radar 4133425
+	* c-common.h (objc_diagnose_private_ivar): New decl.
+	* stub-objc.c (objc_diagnose_private_ivar): New stub.

 2010-10-18  Nicola Pero  <nicola.pero@meta-innovation.com>

@@ -401,19 +390,35 @@

 	2005-11-08  Fariborz Jahanian <fjahanian@apple.com>

-        Radar 4330422
+	Radar 4330422
 	* c-common.h (objc_non_volatilized_type): New declaration
 	* stub-objc.c (objc_non_volatilized_type): New stub.

-2010-10-17  Nicola Pero  <nicola.pero@meta-innovation.com>
+2010-10-18  Michael Meissner  <meissner@linux.vnet.ibm.com>

-	Merge from 'apple/trunk' branch on FSF servers.
+	PR target/46041
+	* c-cppbuiltin.c (mode_has_fma): Move function here from
+	builtins.c.  Don't use the fma optab, instead just use the
+	HAVE_fma* macros, so that __FP_FAST_FMA* will be defined when
+	using -save-temps.

-	2006-03-27 Fariborz Jahanian <fjahanian@apple.com>
+2010-10-18  Nicola Pero  <nicola.pero@meta-innovation.com>

-        Radar 4133425
-	* c-common.h (objc_diagnose_private_ivar): New decl.
-	* stub-objc.c (objc_diagnose_private_ivar): New stub.
+	Implemented parsing @synthesize and @dynamic for
+	Objective-C/Objective-C++.
+	* c-common.h (enum rid): Add RID_AT_SYNTHESIZE and RID_AT_DYNAMIC.
+	(objc_add_synthesize_declaration): New.
+	(objc_add_dynamic_declaration): New.
+	* c-common.c (c_common_reswords): Add synthesize and dynamic.
+	* stub-objc.c (objc_add_synthesize_declaration): New.
+	(objc_add_dynamic_declaration): New.
+
+2010-10-20  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+	* c-common.h (finish_file): Removed.
+	(objc_write_global_declarations): New.
+	* c-opts.c (c_common_parse_file): Do not call finish_file.
+	* stub-objc.c (objc_write_global_declarations): New.

 2010-10-17  Iain Sandoe  <iains@gcc.gnu.org>

@@ -511,7 +516,7 @@
 	objective-c keywords.
 	(objc_set_method_opt): New declaration.
 	* stub-objc.c (objc_set_method_opt): New stub.
-	
+
 2010-09-30  Joseph Myers  <joseph@codesourcery.com>

 	* c-common.c (handle_optimize_attribute): Pass &global_options to
@@ -529,8 +534,8 @@

 2010-09-29  Nicola Pero  <nicola.pero@meta-innovation.com>

-	Merge from 'apple/trunk' branch on FSF servers.	
-	
+	Merge from 'apple/trunk' branch on FSF servers.
+
 	2005-10-04  Fariborz Jahanian <fjahanian@apple.com>

 	Radar 4281748
@@ -562,7 +567,7 @@

 2010-09-28  Iain Sandoe  <iains@gcc.gnu.org>

-	* c-common.h (objc_add_method_declaration): Adjust prototype to 
+	* c-common.h (objc_add_method_declaration): Adjust prototype to
 	include attributes.
 	(objc_start_method_definition): Likewise.
 	(objc_build_keyword_decl): Likewise.
@@ -586,11 +591,11 @@

 2010-09-27  Nicola Pero  <nicola.pero@meta-innovation.com>

-	Merge from 'apple/trunk' branch on FSF servers.	
+	Merge from 'apple/trunk' branch on FSF servers.

 	2005-12-15  Fariborz Jahanian <fjahanian@apple.com>

-	Radar 4229905	
+	Radar 4229905
 	* c-common.h (objc_have_common_type): New declaration.
 	* stub-objc.c (objc_have_common_type): New stub.

@@ -598,7 +603,7 @@

 	Radar 4154928
 	* c-common.h (objc_common_type): New prototype.
-	* stub-objc.c (objc_common_type): New stub.	
+	* stub-objc.c (objc_common_type): New stub.

 2010-09-24  Jan Hubicka  <jh@suse.cz>

@@ -844,8 +849,8 @@

 2010-06-24  Andi Kleen  <ak@linux.intel.com>

-        * c-common.c (warn_for_omitted_condop): New.
-        * c-common.h (warn_for_omitted_condop): Add prototype.
+	* c-common.c (warn_for_omitted_condop): New.
+	* c-common.h (warn_for_omitted_condop): Add prototype.

 2010-06-21  Joseph Myers  <joseph@codesourcery.com>

@@ -891,7 +896,7 @@

 2010-06-11  Manuel López-Ibáñez  <manu@gcc.gnu.org>

-        * c-common.c (conversion_warning): Warn at expression
+	* c-common.c (conversion_warning): Warn at expression
 	location.

 2010-06-10  Joseph Myers  <joseph@codesourcery.com>
@@ -957,7 +962,7 @@

 2010-06-05  Steven Bosscher  <steven@gcc.gnu.org>

-	* c-common.c: Moved to here from parent directory. 
+	* c-common.c: Moved to here from parent directory.
 	* c-common.def: Likewise.
 	* c-common.h: Likewise.
 	* c-cppbuiltin.c: Likewise.
diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c
index 85831eb..2f8887f1 100644
--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -1107,10 +1107,8 @@ init_dollar_format_checking (int first_arg_num, tree params)
     }
   if (dollar_arguments_alloc < dollar_arguments_count)
     {
-      if (dollar_arguments_used)
-	free (dollar_arguments_used);
-      if (dollar_arguments_pointer_p)
-	free (dollar_arguments_pointer_p);
+      free (dollar_arguments_used);
+      free (dollar_arguments_pointer_p);
       dollar_arguments_alloc = dollar_arguments_count;
       dollar_arguments_used = XNEWVEC (char, dollar_arguments_alloc);
       dollar_arguments_pointer_p = XNEWVEC (char, dollar_arguments_alloc);
diff --git a/gcc/calls.c b/gcc/calls.c
index f539f66..de953d0 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -2549,8 +2549,7 @@ expand_call (tree exp, rtx target, int ignore)
 		  highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
 						     needed);
 #endif
-		  if (stack_usage_map_buf)
-		    free (stack_usage_map_buf);
+		  free (stack_usage_map_buf);
 		  stack_usage_map_buf = XNEWVEC (char, highest_outgoing_arg_in_use);
 		  stack_usage_map = stack_usage_map_buf;

@@ -2655,8 +2654,7 @@ expand_call (tree exp, rtx target, int ignore)
 		    = stack_arg_under_construction;
 		  stack_arg_under_construction = 0;
 		  /* Make a new map for the new argument list.  */
-		  if (stack_usage_map_buf)
-		    free (stack_usage_map_buf);
+		  free (stack_usage_map_buf);
 		  stack_usage_map_buf = XCNEWVEC (char, highest_outgoing_arg_in_use);
 		  stack_usage_map = stack_usage_map_buf;
 		  highest_outgoing_arg_in_use = 0;
@@ -3148,8 +3146,7 @@ expand_call (tree exp, rtx target, int ignore)

       /* Free up storage we no longer need.  */
       for (i = 0; i < num_actuals; ++i)
-	if (args[i].aligned_regs)
-	  free (args[i].aligned_regs);
+	free (args[i].aligned_regs);

       insns = get_insns ();
       end_sequence ();
@@ -3204,8 +3201,7 @@ expand_call (tree exp, rtx target, int ignore)

   currently_expanding_call--;

-  if (stack_usage_map_buf)
-    free (stack_usage_map_buf);
+  free (stack_usage_map_buf);

   return target;
 }
@@ -3966,8 +3962,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
       stack_usage_map = initial_stack_usage_map;
     }

-  if (stack_usage_map_buf)
-    free (stack_usage_map_buf);
+  free (stack_usage_map_buf);

   return value;

diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index aaa0ea5..dda4d52 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -650,8 +650,7 @@ try_forward_edges (int mode, basic_block b)
       ei_next (&ei);
     }

-  if (threaded_edges)
-    free (threaded_edges);
+  free (threaded_edges);
   return changed;
 }
 \f
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 42e35b6..9eac3cb 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -2092,8 +2092,7 @@ collect_execute (const char *prog, char **argv, const char *outname,
 	fatal (errmsg);
     }

-  if (response_arg)
-    free (response_arg);
+  free (response_arg);

   return pex;
 }
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 82d999b..936c3cf 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4765,8 +4765,7 @@ ix86_valid_target_attribute_tree (tree args)

       /* Free up memory allocated to hold the strings */
       for (i = 0; i < IX86_FUNCTION_SPECIFIC_MAX; i++)
-	if (option_strings[i])
-	  free (option_strings[i]);
+	free (option_strings[i]);
     }

   return t;
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index 8118276..f527452 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -1978,8 +1978,7 @@ mcore_expand_prolog (void)
       
       gcc_assert (GET_CODE (x) == SYMBOL_REF);
       
-      if (mcore_current_function_name)
-	free (mcore_current_function_name);
+      free (mcore_current_function_name);
       
       mcore_current_function_name = xstrdup (XSTR (x, 0));
       
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 5da5464..b4da548 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -521,8 +521,7 @@ coverage_checksum_string (unsigned chksum, const char *string)
     }

   chksum = crc32_string (chksum, string);
-  if (dup)
-    free (dup);
+  free (dup);

   return chksum;
 }
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f18ce9c..6cfa362 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* tree.c (cxx_printable_name_internal): Remove useless if-before-free.
+
 2011-03-07  Jason Merrill  <jason@redhat.com>

 	PR c++/48003
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 56639ff..91e7078 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1506,8 +1506,7 @@ cxx_printable_name_internal (tree decl, int v, bool translate)
       gcc_assert (uid_ring[ring_counter] != DECL_UID (current_function_decl));
     }

-  if (print_ring[ring_counter])
-    free (print_ring[ring_counter]);
+  free (print_ring[ring_counter]);

   print_ring[ring_counter] = xstrdup (lang_decl_name (decl, v, translate));
   uid_ring[ring_counter] = DECL_UID (decl);
diff --git a/gcc/cse.c b/gcc/cse.c
index f7b477c..d83b38a 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -796,8 +796,7 @@ init_cse_reg_info (unsigned int nregs)
 	}

       /* Reallocate the table with NEW_SIZE entries.  */
-      if (cse_reg_info_table)
-	free (cse_reg_info_table);
+      free (cse_reg_info_table);
       cse_reg_info_table = XNEWVEC (struct cse_reg_info, new_size);
       cse_reg_info_table_size = new_size;
       cse_reg_info_table_first_uninitialized = 0;
@@ -6975,8 +6974,7 @@ delete_trivially_dead_insns (rtx insns, int nreg)
 		df_insn_rescan (insn);
 	      }
 	  }
-      if (replacements)
-	free (replacements);
+      free (replacements);
     }

   if (dump_file && ndead)
diff --git a/gcc/cselib.c b/gcc/cselib.c
index c142d67..ce8564b 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -2429,8 +2429,7 @@ cselib_init (int record_what)
   if (!reg_values || reg_values_size < cselib_nregs
       || (reg_values_size > 10 && reg_values_size > cselib_nregs * 4))
     {
-      if (reg_values)
-	free (reg_values);
+      free (reg_values);
       /* Some space for newly emit instructions so we don't end up
 	 reallocating in between passes.  */
       reg_values_size = cselib_nregs + (63 + cselib_nregs) / 16;
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 36270bf..2860521 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -811,10 +811,8 @@ rest_of_handle_df_finish (void)
       dflow->problem->free_fun ();
     }

-  if (df->postorder)
-    free (df->postorder);
-  if (df->postorder_inverted)
-    free (df->postorder_inverted);
+  free (df->postorder);
+  free (df->postorder_inverted);
   free (df->hard_regs_live_count);
   free (df);
   df = NULL;
@@ -1183,10 +1181,8 @@ df_analyze (void)
   bool everything;
   int i;

-  if (df->postorder)
-    free (df->postorder);
-  if (df->postorder_inverted)
-    free (df->postorder_inverted);
+  free (df->postorder);
+  free (df->postorder_inverted);
   df->postorder = XNEWVEC (int, last_basic_block);
   df->postorder_inverted = XNEWVEC (int, last_basic_block);
   df->n_blocks = post_order_compute (df->postorder, true, true);
@@ -1726,8 +1722,7 @@ df_check_cfg_clean (void)
 static void
 df_set_clean_cfg (void)
 {
-  if (saved_cfg)
-    free (saved_cfg);
+  free (saved_cfg);
   saved_cfg = df_compute_cfg_image ();
 }

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index a479ef6..2f694ff 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* gfortranspec.c (lang_specific_pre_link): Remove useless
+	if-before-free.
+
 2011-03-06  Paul Thomas  <pault@gcc.gnu.org>
 	    Jerry DeLisle  <jvdelisle@gcc.gnu.org>

diff --git a/gcc/fortran/gfortranspec.c b/gcc/fortran/gfortranspec.c
index 2d732fd..4d939a0 100644
--- a/gcc/fortran/gfortranspec.c
+++ b/gcc/fortran/gfortranspec.c
@@ -472,9 +472,8 @@ For more information about these matters, see the file named COPYING\n\n"));
 int
 lang_specific_pre_link (void)
 {
-  if (spec_file)
-    free (spec_file);
-  else if (library)
+  free (spec_file);
+  if (spec_file == NULL && library)
     do_spec ("%:include(libgfortran.spec)");

   return 0;
diff --git a/gcc/function.c b/gcc/function.c
index 19b480d..d5efa4a 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -211,8 +211,7 @@ free_after_compilation (struct function *f)
   prologue_insn_hash = NULL;
   epilogue_insn_hash = NULL;

-  if (crtl->emit.regno_pointer_align)
-    free (crtl->emit.regno_pointer_align);
+  free (crtl->emit.regno_pointer_align);

   memset (crtl, 0, sizeof (struct rtl_data));
   f->eh = NULL;
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 75f522e..6906089 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4782,8 +4782,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
 		    t->filename_length = temp_filename_length;
 		  }

-		if (saved_suffix)
-		  free (saved_suffix);
+		free (saved_suffix);

 		obstack_grow (&obstack, t->filename, t->filename_length);
 		delete_this_arg = 1;
@@ -6700,12 +6699,10 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
 	    {
 	      if (compare_debug)
 		{
-		  if (debug_check_temp_file[0])
-		    free (debug_check_temp_file[0]);
+		  free (debug_check_temp_file[0]);
 		  debug_check_temp_file[0] = NULL;

-		  if (debug_check_temp_file[1])
-		    free (debug_check_temp_file[1]);
+		  free (debug_check_temp_file[1]);
 		  debug_check_temp_file[1] = NULL;
 		}

@@ -6749,12 +6746,10 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"

 	      if (compare_debug)
 		{
-		  if (debug_check_temp_file[0])
-		    free (debug_check_temp_file[0]);
+		  free (debug_check_temp_file[0]);
 		  debug_check_temp_file[0] = NULL;

-		  if (debug_check_temp_file[1])
-		    free (debug_check_temp_file[1]);
+		  free (debug_check_temp_file[1]);
 		  debug_check_temp_file[1] = NULL;
 		}
 	    }
diff --git a/gcc/gcov.c b/gcc/gcov.c
index 2fbeaf5..dd71224 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -661,10 +661,8 @@ create_file_names (const char *file_name)
   int base;

   /* Free previous file names.  */
-  if (bbg_file_name)
-    free (bbg_file_name);
-  if (da_file_name)
-    free (da_file_name);
+  free (bbg_file_name);
+  free (da_file_name);
   da_file_name = bbg_file_name = NULL;
   bbg_file_time = 0;
   bbg_stamp = 0;
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index e81682c..1c308c7 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -350,8 +350,7 @@ identify_predicable_attribute (void)
   if (p_true == NULL || strchr (++p_true, ',') != NULL)
     {
       error_with_line (elem->lineno, "attribute `predicable' is not a boolean");
-      if (p_false)
-        free (p_false);
+      free (p_false);
       return;
     }
   p_true[-1] = '\0';
@@ -367,15 +366,13 @@ identify_predicable_attribute (void)

     case CONST:
       error_with_line (elem->lineno, "attribute `predicable' cannot be const");
-      if (p_false)
-	free (p_false);
+      free (p_false);
       return;

     default:
       error_with_line (elem->lineno,
 		       "attribute `predicable' must have a constant default");
-      if (p_false)
-	free (p_false);
+      free (p_false);
       return;
     }

@@ -387,8 +384,7 @@ identify_predicable_attribute (void)
     {
       error_with_line (elem->lineno,
 		       "unknown value `%s' for `predicable' attribute", value);
-      if (p_false)
-	free (p_false);
+      free (p_false);
     }
 }

diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 47a03d5..83c0d6d 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -114,8 +114,7 @@ save_clast_name_index (htab_t index_table, const char *name, int index)

   if (slot)
     {
-      if (*slot)
-	free (*slot);
+      free (*slot);

       *slot = new_clast_name_index (name, index);
     }
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 064ded3..7474be0 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -190,8 +190,7 @@ free_data_refs_aux (VEC (data_reference_p, heap) *datarefs)
       {
 	base_alias_pair *bap = (base_alias_pair *)(dr->aux);

-	if (bap->alias_set)
-	  free (bap->alias_set);
+	free (bap->alias_set);

 	free (bap);
 	dr->aux = NULL;
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index e16561f..67cef40 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -5556,8 +5556,7 @@ haifa_finish_h_i_d (void)

   FOR_EACH_VEC_ELT (haifa_insn_data_def, h_i_d, i, data)
     {
-      if (data->reg_pressure != NULL)
-	free (data->reg_pressure);
+      free (data->reg_pressure);
       for (use = data->reg_use_list; use != NULL; use = next)
 	{
 	  next = use->next_insn_use;
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 82599f1..58f3303d 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -1893,8 +1893,7 @@ ipa_free_all_edge_args (void)
 void
 ipa_free_node_params_substructures (struct ipa_node_params *info)
 {
-  if (info->params)
-    free (info->params);
+  free (info->params);

   memset (info, 0, sizeof (*info));
 }
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 3b4cc02..6a8b391 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1667,8 +1667,7 @@ local_pure_const (void)
 		 lang_hooks.decl_printable_name (current_function_decl,
 						 2));
     }
-  if (l)
-    free (l);
+  free (l);
   if (changed)
     return execute_fixup_cfg ();
   else
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index f874a2e..40fa6bc 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -913,8 +913,7 @@ propagate (void)
 				  node_g->statics_written);
 	    }
 	}
-      if (node_info)
-	free (node_info);
+      free (node_info);
       if (node->aux)
 	{
 	  free (node->aux);
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 2329613..2afddca 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -1619,22 +1619,17 @@ free_ira_costs (void)
 {
   int i;

-  if (init_cost != NULL)
-    free (init_cost);
+  free (init_cost);
   init_cost = NULL;
   for (i = 0; i < MAX_RECOG_OPERANDS; i++)
     {
-      if (op_costs[i] != NULL)
-	free (op_costs[i]);
-      if (this_op_costs[i] != NULL)
-	free (this_op_costs[i]);
+      free (op_costs[i]);
+      free (this_op_costs[i]);
       op_costs[i] = this_op_costs[i] = NULL;
     }
-  if (temp_costs != NULL)
-    free (temp_costs);
+  free (temp_costs);
   temp_costs = NULL;
-  if (cost_classes != NULL)
-    free (cost_classes);
+  free (cost_classes);
   cost_classes = NULL;
 }

diff --git a/gcc/ira.c b/gcc/ira.c
index 68d47fb..b8a72a3 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -1150,10 +1150,8 @@ free_register_move_costs (void)

   for (mode = 0; mode < MAX_MACHINE_MODE; mode++)
     {
-      if (ira_may_move_in_cost[mode] != NULL)
-	free (ira_may_move_in_cost[mode]);
-      if (ira_may_move_out_cost[mode] != NULL)
-	free (ira_may_move_out_cost[mode]);
+      free (ira_may_move_in_cost[mode]);
+      free (ira_may_move_out_cost[mode]);
       ira_register_move_cost[mode] = NULL;
       ira_may_move_in_cost[mode] = NULL;
       ira_may_move_out_cost[mode] = NULL;
@@ -3036,8 +3034,7 @@ build_insn_chain (void)
     }

   for (i = 0; i < (unsigned int) max_regno; i++)
-    if (live_subregs[i])
-      free (live_subregs[i]);
+    free (live_subregs[i]);

   reload_insn_chain = c;
   *p = NULL;
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 5b95565..0931ad8 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* jcf-parse.c (java_parse_file): Remove useless if-before-free.
+
 2011-02-13  Joseph Myers  <joseph@codesourcery.com>

 	* jvspec.c (jvgenmain_spec): Remove %{a*}.
@@ -17,7 +21,7 @@
 2011-01-07  Kai Tietz  <kai.tietz@onevision.com>

 	PR bootstrap/47215
-        * decl.c (java_init_decl_processing): Initialize unsigned_type_node.
+	* decl.c (java_init_decl_processing): Initialize unsigned_type_node.

 2011-01-07  Kai Tietz  <kai.tietz@onevision.com>

@@ -139,7 +143,7 @@
 2010-10-04  Andi Kleen <ak@linux.intel.com>

 	* Make-lang.in (xgcj, jc1, jcf-dump, jvgenmain):
-        Add + to build rule.
+	Add + to build rule.

 2010-09-29  Joseph Myers  <joseph@codesourcery.com>

@@ -685,7 +689,7 @@
 2009-07-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>

 	* class.c: Replace %J by an explicit location. Update all calls.
-	
+
 2009-07-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>

 	* jcf-parse.c: Replace %H by an explicit location. Update all calls.
@@ -700,7 +704,7 @@
 	(MANGLE_CXX_KEYWORDS): New macro.
 	(append_gpp_mangled_name): Use MANGLE_CXX_KEYWORDS.
 	(append_gpp_mangled_name): Likewise.
-	* mangle.c: Move code to mangle_name.c. 
+	* mangle.c: Move code to mangle_name.c.
 	(mangle_member_name): Don't call cxx_keyword_p.

 2009-06-12  Aldy Hernandez  <aldyh@redhat.com>
@@ -718,7 +722,7 @@
 	* builtins.c: Same.
 	* expr.c: Same.
 	* java-tree.h (PUSH_FIELD): Add location field.
-	
+
 2009-06-09  Ian Lance Taylor  <iant@google.com>

 	* verify.h: Remove extern "C".
@@ -785,9 +789,9 @@

 2009-04-09  Paolo Bonzini  <bonzini@gnu.org>

-        * builtins.c (compareAndSwapLong_builtin,
-        compareAndSwapInt_builtin, compareAndSwapObject_builtin,
-        VMSupportsCS8_builtin): Do not look at sync_compare_and_swap_cc.
+	* builtins.c (compareAndSwapLong_builtin,
+	compareAndSwapInt_builtin, compareAndSwapObject_builtin,
+	VMSupportsCS8_builtin): Do not look at sync_compare_and_swap_cc.

 2009-03-31  Richard Guenther  <rguenther@suse.de>

@@ -932,7 +936,7 @@
 	mixed declarations and code.

 	2008-05-02  Doug Kwan  <dougkwan@google.com>
-	
+
 	* expr.c (build_java_throw_out_of_bounds_exception ): Wrap call to
 	_Jv_ThrowBadArrayIndex with a COMPOUND_EXPR to return 0.

@@ -947,8 +951,8 @@

 	* java-gimplify.c (java_gimplify_expr): Make pre_p and post_p
 	sequences.
-	(java_gimplify_self_mod_expr): Same.                                    
-	* java-tree.h (java_gimplify_expr): Make pre_p and post_p               
+	(java_gimplify_self_mod_expr): Same.
+	* java-tree.h (java_gimplify_expr): Make pre_p and post_p
 	sequences.

 2008-07-24  Jan Hubicka  <jh@suse.cz>
@@ -1094,9 +1098,9 @@

 2008-04-03  Paolo Bonzini  <bonzini@gnu.org>

-        * java-tree.h (insert_block): Kill.
-        * decl.c (insert_block): Kill.
-		
+	* java-tree.h (insert_block): Kill.
+	* decl.c (insert_block): Kill.
+
 2008-04-01  Joseph Myers  <joseph@codesourcery.com>

 	* gcj.texi: Include gpl_v3.texi instead of gpl.texi
@@ -1127,10 +1131,10 @@

 2008-03-11  Paolo Bonzini  <bonzini@gnu.org>

-        * jcf-parse.c (java_parse_file): Assert binding levels are
-        left in order.
-        * lang.c (LANG_HOOKS_CLEAR_BINDING_STACK, java_clear_binding_stack):
-        Delete.
+	* jcf-parse.c (java_parse_file): Assert binding levels are
+	left in order.
+	* lang.c (LANG_HOOKS_CLEAR_BINDING_STACK, java_clear_binding_stack):
+	Delete.

 2008-03-02  Jakub Jelinek  <jakub@redhat.com>

@@ -1459,12 +1463,12 @@
 2007-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

 	* class.c (java_treetreehash_hash, java_treetreehash_compare):
-	Constify. 
+	Constify.
 	* expr.c (type_assertion_eq): Likewise.
 	* jcf-io.c (compare_path): Likewise.
 	* jcf-parse.c (cmpstringp): Likewise.
 	* verify-impl.c (get_one_type, compute_argument_types,
-	compute_return_type): Likewise. 
+	compute_return_type): Likewise.

 2007-07-16  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

@@ -1490,7 +1494,7 @@

 2007-07-03  David Daney  <ddaney@avtrex.com>

-	* java/Make-lang.in (doc/gcj.info): Add $(gcc_docdir) to 
+	* java/Make-lang.in (doc/gcj.info): Add $(gcc_docdir) to
 	include path.
 	(doc/gcj.dvi): Same.
 	(doc/gcj.pdf): Same.
@@ -1541,16 +1545,16 @@

 2007-04-03  Andrew Haley  <aph@redhat.com>

-        * jvgenmain.c (main): Change main to use class$, not class$$.
-        (do_mangle_classname): Likewise.
-        * class.c (hide): New function.
-        (add_field): Hide everything that shouldn't be visible outside a
-        DSO.
-        (build_static_class_ref): Likewise.
-        (build_classdollar_field): Likewise.
-        (make_class_data): Likewise.
-        (layout_class_method): Likewise.
-        * expr.c (special_method_p): New function.
+	* jvgenmain.c (main): Change main to use class$, not class$$.
+	(do_mangle_classname): Likewise.
+	* class.c (hide): New function.
+	(add_field): Hide everything that shouldn't be visible outside a
+	DSO.
+	(build_static_class_ref): Likewise.
+	(build_classdollar_field): Likewise.
+	(make_class_data): Likewise.
+	(layout_class_method): Likewise.
+	* expr.c (special_method_p): New function.

 	* class.c (push_class): Don't bogusly guess the source filename.
 	* jcf-parse.c (give_name_to_class): Don't set input_location from
@@ -2064,7 +2068,7 @@

 	* expr.c (rewrite_arglist_getcaller): New.
 	(rewrite_arglist_getclass): Fix indentation.
-	(rules): Add gnu.classpath.VMStackWalker.getCallingClass() and 
+	(rules): Add gnu.classpath.VMStackWalker.getCallingClass() and
 	gnu.classpath.VMStackWalker.getCallingClassLoader().
 	* builtins.c (initialize_builtins): Remove duplicate def'n of
 	__sync_synchronize.
@@ -2129,21 +2133,21 @@
 	* jcf-parse.c (field_offsets, bit_obstack): New variables.
 	(jcf_parse): Write end marker to annotation_data.
 	(java_parse_file): Create field_offsets bitmap.  Destroy it.
-	(annotation_grow, annotation_rewrite_byte) 
-	(annotation_rewrite_short, annotation_rewrite_int) 
-	(annotation_read_short, annotation_write_byte) 
-	(annotation_write_short, annotation_write_int) 
-	(handle_long_constant, handle_constant, handle_element_value) 
-	(handle_annotation, handle_annotations) 
-	(handle_annotation_attribute, rewrite_reflection_indexes) 
-	(handle_member_annotations, handle_parameter_annotations) 
+	(annotation_grow, annotation_rewrite_byte)
+	(annotation_rewrite_short, annotation_rewrite_int)
+	(annotation_read_short, annotation_write_byte)
+	(annotation_write_short, annotation_write_int)
+	(handle_long_constant, handle_constant, handle_element_value)
+	(handle_annotation, handle_annotations)
+	(handle_annotation_attribute, rewrite_reflection_indexes)
+	(handle_member_annotations, handle_parameter_annotations)
 	(handle_default_annotation): New functions.
-	(HANDLE_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE) 
-	(HANDLE_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE) 
-	(HANDLE_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE) 
-	(HANDLE_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE) 
+	(HANDLE_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE)
+	(HANDLE_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE)
+	(HANDLE_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE)
+	(HANDLE_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE)
 	(HANDLE_ANNOTATIONDEFAULT_ATTRIBUTE): New definitions.
-	* java-tree.h (enum jv_attr_type, enum jv_attr_kind): New. 
+	* java-tree.h (enum jv_attr_type, enum jv_attr_kind): New.
 	(TYPE_REFLECTION_DATA): New.
 	(TYPE_REFLECTION_DATASIZE): New.
 	* jcf.h (enum cpool_tag): Convert a bunch of #define constants to
@@ -2256,7 +2260,7 @@
 	putVolatile_builtin, getVolatile_builtin): New builtins.

 2006-06-08  Andrew Haley  <aph@redhat.com>
- 
+
 	* expr.c (build_field_ref): Pass NULL_TREE as SPECIAL arg to
 	get_symbol_table_index().
 	(maybe_rewrite_invocation): Set SPECIAL if we need to access a
@@ -2276,7 +2280,7 @@
 	it to build_symbol_entry().
 	* parse.y (patch_invoke): Call maybe_rewrite_invocation() and set
 	special accordingly.
- 
+
 2006-09-08  Andrew Haley  <aph@redhat.com>

 	* class.c (layout_class_method): Use build_java_signature, not
@@ -2313,9 +2317,9 @@

 2006-07-07  Andrew Haley  <aph@redhat.com>

-        * jcf-parse.c (set_source_filename): Don't check for
+	* jcf-parse.c (set_source_filename): Don't check for
 	CLASS_FROM_CURRENTLY_COMPILED_P.
-        Remove // comments.
+	Remove // comments.

 2006-07-07  Andrew Haley  <aph@redhat.com>

@@ -2521,7 +2525,7 @@
 	* java-tree.h (update_aliases): Remove
 	* expr.c (expand_iinc): Remove call to update_aliases().
 	(STORE_INTERNAL): Likewise.
-	* decl.c (update_aliases, initialize_local_variable) 
+	* decl.c (update_aliases, initialize_local_variable)
 	(maybe_pushlevels): Set DECL_VALUE_EXPR for debugging decls.

 2006-06-19  Andrew Haley  <aph@redhat.com>
@@ -2821,7 +2825,7 @@

 	* typeck.c (build_java_array_type): Generate TYPE_STUB_DECLs for
 	array types.
-	
+
 2006-02-08  Tom Tromey  <tromey@redhat.com>

 	PR java/22578:
@@ -3060,7 +3064,7 @@
 	* parse.y (maybe_create_class_interface_decl): Set TYPE_PACKAGE for
 	the newly created type. Set import lists here, not in create_class.
 	(jdep_resolve_class): Set current_class.
-	(do_resolve_class): Use current_class's TYPE_PACKAGE to determine 
+	(do_resolve_class): Use current_class's TYPE_PACKAGE to determine
 	the current package context, not ctxp->package.
 	(cicp_cache): Removed.
 	(class_in_current_package): Simplify implementation using TYPE_PACKAGE.
@@ -3070,7 +3074,7 @@

 2005-09-09  Andrew Haley  <aph@redhat.com>

-	PR libgcj/23182 
+	PR libgcj/23182
 	* expr.c (pop_type_0): If the expected type is object or ptr
 	(i.e. void*), return the type of the object we just popped from
 	the stack.
@@ -3228,11 +3232,11 @@
 	empty_statement.

 2005-07-08  Daniel Berlin  <dberlin@dberlin.org>
-	
+
 	* java-tree.h (LABEL_RETURN_LABELS): Use decl_non_common.
 	(LABEL_PENDING_CHAIN): Ditto.
 	(LABEL_PC): Ditto.
-	(DECL_BIT_INDEX): Ditto.	
+	(DECL_BIT_INDEX): Ditto.

 2005-07-07  Bryce McKinlay  <mckinlay@redhat.com>

@@ -3241,7 +3245,7 @@
 	check_inner_class_access.
 	(check_inner_class_access): Use inner_class_accessible.
 	(resolve_inner_class): Simplify arguments. Create circularity hash
-	here. Keep looking for classes if we found one that was inaccessible. 
+	here. Keep looking for classes if we found one that was inaccessible.
 	Return the inaccessible class only if there is no other match.
 	(do_resolve_class): Update for new resolve_inner_class arguments.
 	Don't create circularity_hash here.
@@ -3256,7 +3260,7 @@
 	(java_complete_expand_method): Don't use purge_unchecked_exceptions
 	or save/restore the exception list.
 	(check_thrown_exceptions): Add uncaught exceptions in anonymous
-	class initializers and constructors to the throws clause of the method.	
+	class initializers and constructors to the throws clause of the method.

 2005-07-05  Bryce McKinlay  <mckinlay@redhat.com>

@@ -3431,7 +3435,7 @@

 2005-05-26  Bryce McKinlay  <mckinlay@redhat.com>

-	* decl.c (GCJ_BINARYCOMPAT_ADDITION, 
+	* decl.c (GCJ_BINARYCOMPAT_ADDITION,
 	GCJ_BOOTSTRAP_LOADER_ADDITION): Removed.
 	(FLAG_BINARYCOMPAT_ABI, FLAG_BOOTSTRAP_LOADER,
 	MINOR_BINARYCOMPAT_ABI_VERSION): New.
@@ -3626,7 +3630,7 @@
 2005-04-27  Bryce McKinlay  <mckinlay@redhat.com>

 	* gcj.texi (libgcj Runtime Properties): Remove obsolete
-	gnu.gcj.runtime.NameFinder.* system properties. Update documentation 
+	gnu.gcj.runtime.NameFinder.* system properties. Update documentation
 	for gnu.gcj.runtime.NameFinder.use_addr2line and gnu.gcj.progname.

 2005-04-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
@@ -3673,7 +3677,7 @@

 	* java-except.h (struct eh_range.handler): Remove unused field.
 	(handle_nested_ranges): Remove function declaration.
-	(sanity_check_exception_range): Add function declaration.	
+	(sanity_check_exception_range): Add function declaration.
 	* verify.c (verify_jvm_instructions): Remove call to
 	handle_nested_ranges.
 	* verify-glue.c (verify_jvm_instructions_new): Call
@@ -3772,7 +3776,7 @@

 	PR java/20502
 	* jcf-parse.c (duplicate_class_warning): New function.
-	(java_parse_file): Call duplicate_class_warning if 
+	(java_parse_file): Call duplicate_class_warning if
 	CLASS_FROM_CURRENTLY_COMPILED_P is already set.
 	(parse_zip_file_entries): Likewise. Also set
 	CLASS_FROM_CURRENTLY_COMPILED_P.
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index d10791f..2a1d522 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -1843,8 +1843,7 @@ java_parse_file (void)
       list = next;
     }

-  if (file_list != NULL)
-    free (file_list);
+  free (file_list);

   if (filename_count == 0)
     warning (0, "no input file specified");
diff --git a/gcc/matrix-reorg.c b/gcc/matrix-reorg.c
index c303143..8ea6e84 100644
--- a/gcc/matrix-reorg.c
+++ b/gcc/matrix-reorg.c
@@ -529,12 +529,9 @@ mat_free (void *e)
   if (!mat)
     return;

-  if (mat->free_stmts)
-    free (mat->free_stmts);
-  if (mat->dim_hot_level)
-    free (mat->dim_hot_level);
-  if (mat->malloc_for_level)
-    free (mat->malloc_for_level);
+  free (mat->free_stmts);
+  free (mat->dim_hot_level);
+  free (mat->malloc_for_level);
 }

 /* Find all potential matrices.
diff --git a/gcc/prefix.c b/gcc/prefix.c
index c72203c..0167f9c 100644
--- a/gcc/prefix.c
+++ b/gcc/prefix.c
@@ -103,8 +103,7 @@ get_key_value (char *key)
   if (prefix == 0)
     prefix = std_prefix;

-  if (temp)
-    free (temp);
+  free (temp);

   return prefix;
 }
diff --git a/gcc/profile.c b/gcc/profile.c
index 2334101..ed264bc 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -828,8 +828,7 @@ compute_value_histograms (histogram_values values)
     }

   for (t = 0; t < GCOV_N_VALUE_COUNTERS; t++)
-    if (histogram_counts[t])
-      free (histogram_counts[t]);
+    free (histogram_counts[t]);
 }

 /* The entry basic block will be moved around so that it has index=1,
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 3d58e58..d07febd 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -4206,19 +4206,15 @@ free_reg_equiv (void)
 {
   int i;

-  if (reg_equiv_constant)
-    free (reg_equiv_constant);
-  if (reg_equiv_invariant)
-    free (reg_equiv_invariant);
+  free (reg_equiv_constant);
+  free (reg_equiv_invariant);
   reg_equiv_constant = 0;
   reg_equiv_invariant = 0;
   VEC_free (rtx, gc, reg_equiv_memory_loc_vec);
   reg_equiv_memory_loc = 0;

-  if (offsets_known_at)
-    free (offsets_known_at);
-  if (offsets_at)
-    free (offsets_at);
+  free (offsets_known_at);
+  free (offsets_at);
   offsets_at = 0;
   offsets_known_at = 0;

diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 7293fc3..240e0e3 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -3550,8 +3550,7 @@ free_deps (struct deps_desc *deps)

   /* As we initialize reg_last lazily, it is possible that we didn't allocate
      it at all.  */
-  if (deps->reg_last)
-    free (deps->reg_last);
+  free (deps->reg_last);
   deps->reg_last = NULL;

   deps = NULL;
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index b88dad1..fc31d19 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -580,8 +580,7 @@ fence_clear (fence_t f)
   gcc_assert ((s != NULL && dc != NULL && tc != NULL)
 	      || (s == NULL && dc == NULL && tc == NULL));

-  if (s != NULL)
-    free (s);
+  free (s);

   if (dc != NULL)
     delete_deps_context (dc);
diff --git a/gcc/sese.c b/gcc/sese.c
index bfb0276..3ce83b9 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -449,8 +449,7 @@ set_rename (htab_t rename_map, tree old_name, tree expr)
   if (!slot)
     return;

-  if (*slot)
-    free (*slot);
+  free (*slot);

   *slot = new_rename_map_elt (old_name, expr);
 }
@@ -676,8 +675,7 @@ if_region_set_false_region (ifsese if_region, sese region)

   SESE_EXIT (region) = false_edge;

-  if (if_region->false_region)
-    free (if_region->false_region);
+  free (if_region->false_region);
   if_region->false_region = region;

   if (slot)
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 54cb46c..ef7c414 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -5085,11 +5085,9 @@ free_rdg (struct graph *rdg)
       struct graph_edge *e;

       for (e = v->succ; e; e = e->succ_next)
-	if (e->data)
-	  free (e->data);
+	free (e->data);

-      if (v->data)
-	free (v->data);
+      free (v->data);
     }

   htab_delete (rdg->indices);
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index f189b9b..948a796 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1617,8 +1617,7 @@ lower_try_finally (struct leh_state *state, gimple tp)
     }

   VEC_free (tree, heap, this_tf.dest_array);
-  if (this_tf.goto_queue)
-    free (this_tf.goto_queue);
+  free (this_tf.goto_queue);
   if (this_tf.goto_queue_map)
     pointer_map_destroy (this_tf.goto_queue_map);

diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index e7490e6..2dfe37e 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -242,8 +242,7 @@ delete_coalesce_list (coalesce_list_p cl)
 {
   gcc_assert (cl->cost_one_list == NULL);
   htab_delete (cl->list);
-  if (cl->sorted)
-    free (cl->sorted);
+  free (cl->sorted);
   gcc_assert (cl->num_sorted == 0);
   free (cl);
 }
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 0441df6..4a8a4eb 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -157,10 +157,8 @@ delete_var_map (var_map map)
 {
   var_map_base_fini (map);
   partition_delete (map->var_partition);
-  if (map->partition_to_view)
-    free (map->partition_to_view);
-  if (map->view_to_partition)
-    free (map->view_to_partition);
+  free (map->partition_to_view);
+  free (map->view_to_partition);
   free (map);
 }

diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 479b46f..723812f 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -6254,8 +6254,7 @@ free_loop_data (struct ivopts_data *data)
       struct version_info *info;

       info = ver_info (data, i);
-      if (info->iv)
-	free (info->iv);
+      free (info->iv);
       info->iv = NULL;
       info->has_nonlin_use = false;
       info->preserve_biv = false;
@@ -6282,8 +6281,7 @@ free_loop_data (struct ivopts_data *data)
     {
       struct iv_cand *cand = iv_cand (data, i);

-      if (cand->iv)
-	free (cand->iv);
+      free (cand->iv);
       if (cand->depends_on)
 	BITMAP_FREE (cand->depends_on);
       free (cand);
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index f246643..f13adaf 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -580,8 +580,7 @@ phi_trans_add (pre_expr e, pre_expr v, basic_block pred)

   slot = htab_find_slot_with_hash (phi_translate_table, new_pair,
 				   new_pair->hashcode, INSERT);
-  if (*slot)
-    free (*slot);
+  free (*slot);
   *slot = (void *) new_pair;
 }

diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index e90f753..089408b 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,5 +1,12 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* files.c (destroy_cpp_file): Remove useless if-before-free.
+	* init.c (cpp_destroy): Likewise.
+	* macro.c (replace_args): Likewise.
+	* pch.c (cpp_valid_state): Likewise.
+
 2011-11-04  Eric Botcazou  <ebotcazou@adacore.com>
-            Jakub Jelinek  <jakub@redhat.com>
+	    Jakub Jelinek  <jakub@redhat.com>

 	PR preprocessor/39213
 	* directives.c (end_directive): Call _cpp_remove_overlay for deferred
@@ -752,7 +759,7 @@
 	* directives-only.c (_cpp_preprocess_dir_only): Likewise.
 	* internal.h (CPP_INCREMENT_LINE): Likewise.
 	* lex.c (_cpp_skip_block_comment): Use source_location.
-	
+
 2008-07-14  Ben Elliston  <bje@au.ibm.com>

 	* include/cpplib.h (NODE_CONDITIONAL): New.
@@ -1018,7 +1025,7 @@

 	PR preprocessor/30363
 	* traditional.c (replace_args_and_push): Add local variable
-	cxtquote, calculate the replacement text size assuming a 
+	cxtquote, calculate the replacement text size assuming a
 	worst case of every input character quoted with backslash,
 	and properly handle output quoting of quote characters in
 	actual arguments used in function-like macros.
@@ -1172,8 +1179,8 @@
 2007-06-09  Vladimir Prus  <vladimir@codesourcery.com>

 	* files.c (open_file): Account for the
-        fact that on windows, opening a directory gives
-        EACCES.
+	fact that on windows, opening a directory gives
+	EACCES.

 2007-06-05  Joerg Wunsch  <j.gnu@uriah.heep.sax.de>

@@ -1225,7 +1232,7 @@

 2007-05-14  Janis Johnson  <janis187@us.ibm.com>

-        * expr.c (cpp_classify_number): Warn about dfp constant for -pedantic.
+	* expr.c (cpp_classify_number): Warn about dfp constant for -pedantic.

 	PR c/31924
 	* expr.c (interpret_float_suffix): Check for invalid suffix.
diff --git a/libcpp/files.c b/libcpp/files.c
index 456c0b0..f464fea 100644
--- a/libcpp/files.c
+++ b/libcpp/files.c
@@ -996,8 +996,7 @@ make_cpp_file (cpp_reader *pfile, cpp_dir *dir, const char *fname)
 static void
 destroy_cpp_file (_cpp_file *file)
 {
-  if (file->buffer_start)
-    free ((void *) file->buffer_start);
+  free ((void *) file->buffer_start);
   free ((void *) file->name);
   free (file);
 }
diff --git a/libcpp/init.c b/libcpp/init.c
index cfc16e8..ae1c0b8 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -258,8 +258,7 @@ cpp_destroy (cpp_reader *pfile)
   while (CPP_BUFFER (pfile) != NULL)
     _cpp_pop_buffer (pfile);

-  if (pfile->out.base)
-    free (pfile->out.base);
+  free (pfile->out.base);

   if (pfile->macro_buffer)
     {
diff --git a/libcpp/macro.c b/libcpp/macro.c
index d9324a3..eba2349 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -1064,8 +1064,7 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro, macro_arg

   /* Free the expanded arguments.  */
   for (i = 0; i < macro->paramc; i++)
-    if (args[i].expanded)
-      free (args[i].expanded);
+    free (args[i].expanded);

   push_ptoken_context (pfile, node, buff, first, dest - first);
 }
diff --git a/libcpp/pch.c b/libcpp/pch.c
index 00b7794..d278f14 100644
--- a/libcpp/pch.c
+++ b/libcpp/pch.c
@@ -713,12 +713,9 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
   return -1;

  fail:
-  if (namebuf != NULL)
-    free (namebuf);
-  if (undeftab != NULL)
-    free (undeftab);
-  if (nl.defs != NULL)
-    free (nl.defs);
+  free (namebuf);
+  free (undeftab);
+  free (nl.defs);
   return 1;
 }

diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog
index 101cda9..031793b 100644
--- a/libdecnumber/ChangeLog
+++ b/libdecnumber/ChangeLog
@@ -1,3 +1,12 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* decNumber.c (decNumberFromString): Remove useless
+	if-before-free test.
+	(decNumberCompareTotalMag, decNumberExp, decNumberFMA): Likewise.
+	(decNumberLn, decNumberLog10, decNumberPower): Likewise.
+	(decNumberReduce, decNumberSquareRoot, decAddOp): Likewise.
+	(decDivideOp, NEEDTWO, decExpOp, LN2): Likewise.
+
 2010-11-24  Nathan Froyd  <froydnj@codesourcery.com>

 	* dconfig.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Delete.
@@ -10,7 +19,7 @@

 2010-09-10  Kai Tietz  <kai.tietz@onevision.com>

-       * configure: Regenerated.
+	* configure: Regenerated.

 2010-09-08  Tristan Gingold  <gingold@adacore.com>

@@ -149,7 +158,7 @@

 2009-04-01  Ben Elliston  <bje@au.ibm.com>

-        * decContext.h: Include gstdint.h instead of <stdint.h>.
+	* decContext.h: Include gstdint.h instead of <stdint.h>.

 2009-03-30  Ben Elliston  <bje@au.ibm.com>

@@ -401,7 +410,7 @@

 	* Makefile.in: Don't include decRound in library used by compiler.

-2006-10-10  Brooks Moses  <bmoses@stanford.edu> 
+2006-10-10  Brooks Moses  <bmoses@stanford.edu>
 	* Makefile.in: Added empty "pdf" target.

 2006-09-15  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
@@ -496,11 +505,11 @@

 2006-01-02  Paolo Bonzini  <bonzini@gnu.org>

-        PR target/25259
-        * configure.ac: Use GCC_HEADER_STDINT.
-        * decContext.h: Include gstdint.h.
-        * aclocal.m4: Regenerate.
-        * configure: Regenerate.
+	PR target/25259
+	* configure.ac: Use GCC_HEADER_STDINT.
+	* decContext.h: Include gstdint.h.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.

 2005-12-20  Roger Sayle  <roger@eyesopen.com>

@@ -539,7 +548,7 @@
 	* decimal32.c: Ditto.
 	* decimal64.c: Ditto.
 	* decimal128.c: Ditto.
-	
+
 2005-11-29  Ben Elliston  <bje@au.ibm.com>

 	* decUtility.c: Remove redundant #includes.
@@ -556,7 +565,7 @@
 2005-11-29  Ben Elliston  <bje@au.ibm.com>

 	* decimal32.h, decimal64.h, decimal128.h: New.
-        * decimal32.c, decimal64.c, decimal128.c: Likewise.
+	* decimal32.c, decimal64.c, decimal128.c: Likewise.
 	* decContext.c, decContext.h: Likewise.
 	* decUtility.c, decUtility.h: Likewise.
 	* decNumber.c, decNumber.h, decNumberLocal.h: Likewise.
diff --git a/libdecnumber/decNumber.c b/libdecnumber/decNumber.c
index d097cab..cf2d32e 100644
--- a/libdecnumber/decNumber.c
+++ b/libdecnumber/decNumber.c
@@ -711,7 +711,7 @@ decNumber * decNumberFromString(decNumber *dn, const char chars[],
     /* decNumberShow(dn); */
     } while(0); 			/* [for break] */

-  if (allocres!=NULL) free(allocres);	/* drop any storage used */
+  free(allocres);	/* drop any storage used */
   if (status!=0) decStatus(dn, status, set);
   return dn;
   } /* decNumberFromString */
@@ -970,8 +970,8 @@ decNumber * decNumberCompareTotalMag(decNumber *res, const decNumber *lhs,
     decCompareOp(res, lhs, rhs, set, COMPTOTAL, &status);
     } while(0); 			/* end protected */

-  if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
-  if (allocbufb!=NULL) free(allocbufb); /* .. */
+  free(allocbufa); /* drop any storage used */
+  free(allocbufb); /* .. */
   if (status!=0) decStatus(res, status, set);
   return res;
   } /* decNumberCompareTotalMag */
@@ -1074,7 +1074,7 @@ decNumber * decNumberExp(decNumber *res, const decNumber *rhs,
     } while(0); 			/* end protected */

   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);	/* drop any storage used */
+  free(allocrhs);	/* drop any storage used */
   #endif
   /* apply significant status */
   if (status!=0) decStatus(res, status, set);
@@ -1169,7 +1169,7 @@ decNumber * decNumberFMA(decNumber *res, const decNumber *lhs,
     decAddOp(res, acc, fhs, set, 0, &status);
     } while(0); 			/* end protected */

-  if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
+  free(allocbufa); /* drop any storage used */
   if (status!=0) decStatus(res, status, set);
   #if DECCHECK
   decCheckInexact(res, set);
@@ -1296,7 +1296,7 @@ decNumber * decNumberLn(decNumber *res, const decNumber *rhs,
     } while(0); 			/* end protected */

   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);	/* drop any storage used */
+  free(allocrhs);	/* drop any storage used */
   #endif
   /* apply significant status */
   if (status!=0) decStatus(res, status, set);
@@ -1509,10 +1509,10 @@ decNumber * decNumberLog10(decNumber *res, const decNumber *rhs,
     decDivideOp(res, a, b, &aset, DIVIDE, &status); /* into result */
     } while(0); 			/* [for break] */

-  if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
-  if (allocbufb!=NULL) free(allocbufb); /* .. */
+  free(allocbufa); /* drop any storage used */
+  free(allocbufb); /* .. */
   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);	/* .. */
+  free(allocrhs);	/* .. */
   #endif
   /* apply significant status */
   if (status!=0) decStatus(res, status, set);
@@ -2253,11 +2253,11 @@ decNumber * decNumberPower(decNumber *res, const decNumber *lhs,
     #endif
     } while(0); 			/* end protected */

-  if (allocdac!=NULL) free(allocdac);	/* drop any storage used */
-  if (allocinv!=NULL) free(allocinv);	/* .. */
+  free(allocdac);	/* drop any storage used */
+  free(allocinv);	/* .. */
   #if DECSUBSET
-  if (alloclhs!=NULL) free(alloclhs);	/* .. */
-  if (allocrhs!=NULL) free(allocrhs);	/* .. */
+  free(alloclhs);	/* .. */
+  free(allocrhs);	/* .. */
   #endif
   if (status!=0) decStatus(res, status, set);
   #if DECCHECK
@@ -2349,7 +2349,7 @@ decNumber * decNumberReduce(decNumber *res, const decNumber *rhs,
     } while(0); 			     /* end protected */

   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);	     /* .. */
+  free(allocrhs);	     /* .. */
   #endif
   if (status!=0) decStatus(res, status, set);/* then report status */
   return res;
@@ -3111,11 +3111,11 @@ decNumber * decNumberSquareRoot(decNumber *res, const decNumber *rhs,
     decNumberCopy(res, a);		     /* a is now the result */
     } while(0); 			     /* end protected */

-  if (allocbuff!=NULL) free(allocbuff);      /* drop any storage used */
-  if (allocbufa!=NULL) free(allocbufa);      /* .. */
-  if (allocbufb!=NULL) free(allocbufb);      /* .. */
+  free(allocbuff);      /* drop any storage used */
+  free(allocbufa);      /* .. */
+  free(allocbufb);      /* .. */
   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);	     /* .. */
+  free(allocrhs);	     /* .. */
   #endif
   if (status!=0) decStatus(res, status, set);/* then report status */
   #if DECCHECK
@@ -4130,10 +4130,10 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs,
       }
     } while(0); 			     /* end protected */

-  if (allocacc!=NULL) free(allocacc);	     /* drop any storage used */
+  free(allocacc);	     /* drop any storage used */
   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);	     /* .. */
-  if (alloclhs!=NULL) free(alloclhs);	     /* .. */
+  free(allocrhs);	     /* .. */
+  free(alloclhs);	     /* .. */
   #endif
   return res;
   } /* decAddOp */
@@ -4782,11 +4782,11 @@ static decNumber * decDivideOp(decNumber *res,
     #endif
     } while(0); 			     /* end protected */

-  if (varalloc!=NULL) free(varalloc);	/* drop any storage used */
-  if (allocacc!=NULL) free(allocacc);	/* .. */
+  free(varalloc);	/* drop any storage used */
+  free(allocacc);	/* .. */
   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);	/* .. */
-  if (alloclhs!=NULL) free(alloclhs);	/* .. */
+  free(allocrhs);	/* .. */
+  free(alloclhs);	/* .. */
   #endif
   return res;
   } /* decDivideOp */
@@ -5127,14 +5127,14 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs,
     decFinish(res, set, &residue, status);   /* final cleanup */
     } while(0); 			/* end protected */

-  if (allocacc!=NULL) free(allocacc);	/* drop any storage used */
+  free(allocacc);	/* drop any storage used */
   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);	/* .. */
-  if (alloclhs!=NULL) free(alloclhs);	/* .. */
+  free(allocrhs);	/* .. */
+  free(alloclhs);	/* .. */
   #endif
   #if FASTMUL
-  if (allocrhi!=NULL) free(allocrhi);	/* .. */
-  if (alloclhi!=NULL) free(alloclhi);	/* .. */
+  free(allocrhi);	/* .. */
+  free(alloclhi);	/* .. */
   #endif
   return res;
   } /* decMultiplyOp */
@@ -5483,9 +5483,9 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs,
     decFinish(res, set, &residue, status);	 /* cleanup/set flags */
     } while(0); 			/* end protected */

-  if (allocrhs !=NULL) free(allocrhs);	/* drop any storage used */
-  if (allocbufa!=NULL) free(allocbufa); /* .. */
-  if (allocbuft!=NULL) free(allocbuft); /* .. */
+  free(allocrhs);	/* drop any storage used */
+  free(allocbufa); /* .. */
+  free(allocbuft); /* .. */
   /* [status is handled by caller] */
   return res;
   } /* decExpOp */
@@ -5794,8 +5794,8 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs,
     decFinish(res, set, &residue, status);	 /* cleanup/set flags */
     } while(0); 			/* end protected */

-  if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
-  if (allocbufb!=NULL) free(allocbufb); /* .. */
+  free(allocbufa); /* drop any storage used */
+  free(allocbufb); /* .. */
   /* [status is handled by caller] */
   return res;
   } /* decLnOp */
@@ -5959,8 +5959,8 @@ static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs,
     } while(0); 			/* end protected */

   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);	/* drop any storage used */
-  if (alloclhs!=NULL) free(alloclhs);	/* .. */
+  free(allocrhs);	/* drop any storage used */
+  free(alloclhs);	/* .. */
   #endif
   return res;
   } /* decQuantizeOp */
@@ -6142,8 +6142,8 @@ decNumber * decCompareOp(decNumber *res, const decNumber *lhs,
       }
     }
   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);	/* free any storage used */
-  if (alloclhs!=NULL) free(alloclhs);	/* .. */
+  free(allocrhs);	/* free any storage used */
+  free(alloclhs);	/* .. */
   #endif
   return res;
   } /* decCompareOp */
@@ -6277,7 +6277,7 @@ static Int decUnitCompare(const Unit *a, Int alength,
     result=(*u==0 ? 0 : +1);
     }
   /* clean up and return the result */
-  if (allocacc!=NULL) free(allocacc);	/* drop any storage used */
+  free(allocacc);	/* drop any storage used */
   return result;
   } /* decUnitCompare */

diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 33e2836..fc65f98 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,8 +1,12 @@
-2011-03-04  Janne Blomqvist  <jb@gcc.gnu.org>
-
-	PR libfortran/47802
-	* intrinsics/ctime.c (strctime): Use builtins to check localtime_r
-	return type.
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* intrinsics/move_alloc.c (move_alloc): Remove useless
+	if-before-free test.
+	* io/fbuf.c (fbuf_destroy): Likewise.
+	* io/format.c (save_parsed_format): Likewise.
+	* io/open.c (already_open): Likewise.
+	* io/unit.c (free_internal_unit, close_unit_1): Likewise.
+	* io/unix.c (mem_close): Likewise.

 2011-03-04  Janne Blomqvist  <jb@gcc.gnu.org>

diff --git a/libgfortran/intrinsics/move_alloc.c b/libgfortran/intrinsics/move_alloc.c
index 9b5497c..f76c20c 100644
--- a/libgfortran/intrinsics/move_alloc.c
+++ b/libgfortran/intrinsics/move_alloc.c
@@ -37,8 +37,7 @@ move_alloc (gfc_array_char * from, gfc_array_char * to)
 {
   int i;

-  if (to->data)
-    free (to->data);
+  free (to->data);

   for (i = 0; i < GFC_DESCRIPTOR_RANK (from); i++)
     {
diff --git a/libgfortran/io/fbuf.c b/libgfortran/io/fbuf.c
index 82b3f6b..353e5ae 100644
--- a/libgfortran/io/fbuf.c
+++ b/libgfortran/io/fbuf.c
@@ -51,8 +51,7 @@ fbuf_destroy (gfc_unit * u)
 {
   if (u->fbuf == NULL)
     return;
-  if (u->fbuf->buf)
-    free (u->fbuf->buf);
+  free (u->fbuf->buf);
   free (u->fbuf);
   u->fbuf = NULL;
 }
diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c
index d540fc4..70f4f2d 100644
--- a/libgfortran/io/format.c
+++ b/libgfortran/io/format.c
@@ -149,8 +149,7 @@ save_parsed_format (st_parameter_dt *dtp)
     free_format_data (u->format_hash_table[hash].hashed_fmt);
   u->format_hash_table[hash].hashed_fmt = NULL;

-  if (u->format_hash_table[hash].key != NULL)
-    free (u->format_hash_table[hash].key);
+  free (u->format_hash_table[hash].key);
   u->format_hash_table[hash].key = get_mem (dtp->format_len);
   memcpy (u->format_hash_table[hash].key, dtp->format, dtp->format_len);

diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index d7448c0..f0abeeb 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -689,8 +689,7 @@ already_open (st_parameter_open *opp, gfc_unit * u, unit_flags * flags)
 	}

       u->s = NULL;
-      if (u->file)
-	free (u->file);
+      free (u->file);
       u->file = NULL;
       u->file_len = 0;

diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index 1d52217..e8a9b84 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -483,11 +483,9 @@ free_internal_unit (st_parameter_dt *dtp)

   if (dtp->u.p.current_unit != NULL)
     {
-      if (dtp->u.p.current_unit->ls != NULL)
-	free (dtp->u.p.current_unit->ls);
+      free (dtp->u.p.current_unit->ls);
   
-      if (dtp->u.p.current_unit->s)
-	free (dtp->u.p.current_unit->s);
+      free (dtp->u.p.current_unit->s);
   
       destroy_unit_mutex (dtp->u.p.current_unit);
     }
@@ -652,8 +650,7 @@ close_unit_1 (gfc_unit *u, int locked)

   delete_unit (u);

-  if (u->file)
-    free (u->file);
+  free (u->file);
   u->file = NULL;
   u->file_len = 0;

diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 12536ca..fd16fbe 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -849,8 +849,7 @@ mem_flush (unix_stream * s __attribute__ ((unused)))
 static int
 mem_close (unix_stream * s)
 {
-  if (s != NULL)
-    free (s);
+  free (s);

   return 0;
 }
diff --git a/libgo/runtime/go-select.c b/libgo/runtime/go-select.c
index 9d9f728..8f35a10 100644
--- a/libgo/runtime/go-select.c
+++ b/libgo/runtime/go-select.c
@@ -690,8 +690,7 @@ __go_select (size_t count, _Bool has_default,
 	      continue;
 	    }

-	  if (allocated_buffer != NULL)
-	    free (allocated_buffer);
+	  free (allocated_buffer);

 	  return ret;
 	}
@@ -703,8 +702,7 @@ __go_select (size_t count, _Bool has_default,
       if (has_default)
 	{
 	  /* Use the default clause.  */
-	  if (allocated_buffer != NULL)
-	    free (allocated_buffer);
+	  free (allocated_buffer);
 	  return 0;
 	}

diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 802cf96..64f7370 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,5 +1,18 @@
 2011-03-08  Jim Meyering  <meyering@redhat.com>

+	* cp-demint.c (cplus_demangle_v3_components): Remove useless
+	if-before-free.
+	* cplus-dem.c (squangle_mop_up): Likewise.
+	(delete_non_B_K_work_stuff): Likewise.
+	* pex-common.c (pex_free): Likewise.
+	* pex-msdos.c (pex_msdos_cleanup): Likewise.
+	* pex-win32.c (mingw_rootify, msys_rootify): Likewise.
+	(win32_spawn): Likewise.
+	* regex.c (FREE_VAR, weak_alias): Likewise.
+	* spaces.c (spaces): Likewise.
+
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
 	avoid memory overrun in a test leading to potential double-free
 	* testsuite/test-expandargv.c (writeout_test): Fix off-by-one error:
 	i.e., do copy the trailing NUL byte.
@@ -481,7 +494,7 @@

 2009-05-29  Kai Tietz  <kai.tietz@onevision.com>

-        * pex-win32.c (pex_win32_fdopenr): Set INHERIT to false.
+	* pex-win32.c (pex_win32_fdopenr): Set INHERIT to false.

 2009-05-29  Michael Matz  <matz@suse.de>

@@ -512,7 +525,7 @@

 2009-04-29  Julian Brown  <julian@codesourcery.com>

-	* pex-win32.c (pex_win32_pipe): Add _O_NOINHERIT.    
+	* pex-win32.c (pex_win32_pipe): Add _O_NOINHERIT.
 	(pex_win32_exec_child): Ensure each process has only one handle open
 	on pipe endpoints. Close standard input after creating child for
 	symmetry with standard output/standard error.
@@ -530,22 +543,22 @@
 	section, so that the native build does detect them at configure
 	time.
 	* configure: Regenerated.
-	
+
 2009-04-13  Ozkan Sezer  <sezeroz@gmail.com>

-        PR target/39397
-        * pex-common.h (struct pex_obj): Store pid values as pid_t,
-        not as long (members *children and (*wait))
-        * pex-common.c (pex_run_in_environment): Likewise.
-        * pex-win32.c (pex_win32_wait): Return pid_t and properly check
-        returned pid value.
-        * pex-djgpp.c (pex_djgpp_wait): Return pid_t.
-        * pex-msdos.c (pex_msdos_wait): Likewise.
+	PR target/39397
+	* pex-common.h (struct pex_obj): Store pid values as pid_t,
+	not as long (members *children and (*wait))
+	* pex-common.c (pex_run_in_environment): Likewise.
+	* pex-win32.c (pex_win32_wait): Return pid_t and properly check
+	returned pid value.
+	* pex-djgpp.c (pex_djgpp_wait): Return pid_t.
+	* pex-msdos.c (pex_msdos_wait): Likewise.

 2009-04-07  Arnaud Patard <apatard@mandriva.com>

-       * libiberty/configure.ac: Fix Linux/MIPS matching rule.
-       * libiberty/configure: Regenerate.
+	* libiberty/configure.ac: Fix Linux/MIPS matching rule.
+	* libiberty/configure: Regenerate.

 2009-03-27  Ian Lance Taylor  <iant@google.com>

@@ -630,7 +643,7 @@
 2008-10-08  David Edelsohn  <edelsohn@gnu.org>

 	* xstrdup.c: Include <sys/types.h> after "config.h"
- 
+
 2008-10-07  Jan Kratochvil  <jan.kratochvil@redhat.com>

 	* configure.ac: Call AC_SYS_LARGEFILE.
diff --git a/libiberty/cp-demint.c b/libiberty/cp-demint.c
index 2e8f8d2..1d1a77a 100644
--- a/libiberty/cp-demint.c
+++ b/libiberty/cp-demint.c
@@ -206,10 +206,8 @@ cplus_demangle_v3_components (const char *mangled, int options, void **mem)
 	     malloc (di.num_subs * sizeof (struct demangle_component *)));
   if (di.comps == NULL || di.subs == NULL)
     {
-      if (di.comps != NULL)
-	free (di.comps);
-      if (di.subs != NULL)
-	free (di.subs);
+      free (di.comps);
+      free (di.subs);
       return NULL;
     }

diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c
index 84f94b6..629d77b 100644
--- a/libiberty/cplus-dem.c
+++ b/libiberty/cplus-dem.c
@@ -1215,14 +1215,8 @@ squangle_mop_up (struct work_stuff *work)
 {
   /* clean up the B and K type mangling types. */
   forget_B_and_K_types (work);
-  if (work -> btypevec != NULL)
-    {
-      free ((char *) work -> btypevec);
-    }
-  if (work -> ktypevec != NULL)
-    {
-      free ((char *) work -> ktypevec);
-    }
+  free ((char *) work -> btypevec);
+  free ((char *) work -> ktypevec);
 }


@@ -1311,8 +1305,7 @@ delete_non_B_K_work_stuff (struct work_stuff *work)
       int i;

       for (i = 0; i < work->ntmpl_args; i++)
-	if (work->tmpl_argvec[i])
-	  free ((char*) work->tmpl_argvec[i]);
+	free ((char*) work->tmpl_argvec[i]);

       free ((char*) work->tmpl_argvec);
       work->tmpl_argvec = NULL;
diff --git a/libiberty/pex-common.c b/libiberty/pex-common.c
index 55b63ae..6fd3fde 100644
--- a/libiberty/pex-common.c
+++ b/libiberty/pex-common.c
@@ -623,12 +623,9 @@ pex_free (struct pex_obj *obj)

   if (obj->next_input_name_allocated)
     free (obj->next_input_name);
-  if (obj->children != NULL)
-    free (obj->children);
-  if (obj->status != NULL)
-    free (obj->status);
-  if (obj->time != NULL)
-    free (obj->time);
+  free (obj->children);
+  free (obj->status);
+  free (obj->time);

   if (obj->remove_count > 0)
     {
diff --git a/libiberty/pex-msdos.c b/libiberty/pex-msdos.c
index 4b77bf6..fa0f40a 100644
--- a/libiberty/pex-msdos.c
+++ b/libiberty/pex-msdos.c
@@ -310,10 +310,8 @@ pex_msdos_cleanup (struct pex_obj  *obj)

   ms = (struct pex_msdos *) obj->sysdep;
   for (i = 0; i < PEX_MSDOS_FILE_COUNT; ++i)
-    if (msdos->files[i] != NULL)
-      free (msdos->files[i]);
-  if (msdos->statuses != NULL)
-    free (msdos->statuses);
+    free (msdos->files[i]);
+  free (msdos->statuses);
   free (msdos);
   obj->sysdep = NULL;
 }
diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c
index 4427406..107ac6f 100644
--- a/libiberty/pex-win32.c
+++ b/libiberty/pex-win32.c
@@ -210,10 +210,8 @@ mingw_rootify (const char *executable)
   if (!namebuf || !foundbuf)
     {
       RegCloseKey (hKey);
-      if (namebuf)
-	free (namebuf);
-      if (foundbuf)
-	free (foundbuf);
+      free (namebuf);
+      free (foundbuf);
       return executable;
     }

@@ -315,8 +313,7 @@ msys_rootify (const char *executable)
     return tack_on_executable (buf, executable);

   /* failed */
-  if (buf)
-    free (buf);
+  free (buf);
   return executable;
 }
 #endif
@@ -607,8 +604,7 @@ win32_spawn (const char *executable,
 		      si,
 		      pi))
     {
-      if (env_block)
-        free (env_block);
+      free (env_block);

       free (full_executable);

@@ -618,18 +614,14 @@ win32_spawn (const char *executable,
   /* Clean up.  */
   CloseHandle (pi->hThread);
   free (full_executable);
-  if (env_block)
-    free (env_block);
+  free (env_block);

   return (pid_t) pi->hProcess;

  error:
-  if (env_block)
-    free (env_block);
-  if (cmdline)
-    free (cmdline);
-  if (full_executable)
-    free (full_executable);
+  free (env_block);
+  free (cmdline);
+  free (full_executable);

   return (pid_t) -1;
 }
diff --git a/libiberty/regex.c b/libiberty/regex.c
index 420c7f4..d65eedb 100644
--- a/libiberty/regex.c
+++ b/libiberty/regex.c
@@ -4970,7 +4970,7 @@ weak_alias (__re_search_2, re_search_2)
 #ifdef MATCH_MAY_ALLOCATE
 # define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL
 #else
-# define FREE_VAR(var) if (var) free (var); var = NULL
+# define FREE_VAR(var) free (var); var = NULL
 #endif

 #ifdef WCHAR
@@ -8111,20 +8111,17 @@ weak_alias (__regerror, regerror)
 void
 regfree (regex_t *preg)
 {
-  if (preg->buffer != NULL)
-    free (preg->buffer);
+  free (preg->buffer);
   preg->buffer = NULL;

   preg->allocated = 0;
   preg->used = 0;

-  if (preg->fastmap != NULL)
-    free (preg->fastmap);
+  free (preg->fastmap);
   preg->fastmap = NULL;
   preg->fastmap_accurate = 0;

-  if (preg->translate != NULL)
-    free (preg->translate);
+  free (preg->translate);
   preg->translate = NULL;
 }
 #ifdef _LIBC
diff --git a/libiberty/spaces.c b/libiberty/spaces.c
index 67481c9..69d7a2d 100644
--- a/libiberty/spaces.c
+++ b/libiberty/spaces.c
@@ -53,10 +53,7 @@ spaces (int count)

   if (count > maxsize)
     {
-      if (buf)
-	{
-	  free (buf);
-	}
+      free (buf);
       buf = (char *) malloc (count + 1);
       if (buf == (char *) 0)
 	return 0;
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 44c87be..e77ea9f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* libsupc++/del_opnt.cc (operator delete): Remove useless
+	if-before-free.
+
 2011-03-07  Jason Merrill  <jason@redhat.com>

 	* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Adjust
diff --git a/libstdc++-v3/libsupc++/del_opnt.cc b/libstdc++-v3/libsupc++/del_opnt.cc
index 75051d5..29eab10 100644
--- a/libstdc++-v3/libsupc++/del_opnt.cc
+++ b/libstdc++-v3/libsupc++/del_opnt.cc
@@ -31,6 +31,5 @@ extern "C" void free (void *);
 _GLIBCXX_WEAK_DEFINITION void
 operator delete (void *ptr, const std::nothrow_t&) throw ()
 {
-  if (ptr)
-    free (ptr);
+  free (ptr);
 }
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog
index e4a19cd..6e552ab 100644
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* lto-plugin.c (free_1, free_2): Remove useless if-before-free.
+
 2011-02-13  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

 	* Makefile.in: Regenerate.
@@ -376,7 +380,7 @@
 	(onload): Don't create the temporary directory.

 2009-11-04  Richard Guenther  <rguenther@suse.de>
-            Rafael Avila de Espindola  <espindola@google.com>
+	    Rafael Avila de Espindola  <espindola@google.com>

 	* lto-plugin.c (plugin_file_info): Remove temp field.
 	(cleanup_handler): Don't delete temporary objects.
@@ -411,10 +415,10 @@
 	* aclocal.m4: Likewise.

 2009-10-19  Rafael Avila de Espindola  <espindola@google.com>
-    
-        PR40790
-        * configure: Regenerate.
-        * configure.ac: Add AC_TYPE_UINT64_T.
+
+	PR40790
+	* configure: Regenerate.
+	* configure.ac: Add AC_TYPE_UINT64_T.

 2009-10-16  Rafael Avila de Espindola  <espindola@google.com>

@@ -499,7 +503,7 @@
 	(num_pass_through_items): New.
 	(all_symbols_read_handler): Update to use the -pass-through option.
 	(process_option): Replace -libgcc with -pass-through.
-	
+
 2009-09-30  Rafael Avila de Espindola  <espindola@google.com>

 	* lto-plugin.c (onload): Return a ld_plugin_status. Don't require
@@ -655,7 +659,7 @@

 2008-09-23  Rafael Espindola  <espindola@google.com>

-        * plugin-api.h: Moved to include.
+	* plugin-api.h: Moved to include.

 2008-09-23 Rafael Espindola  <espindola@google.com>

diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index 64a0164..6f8a387 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -312,8 +312,7 @@ free_1 (void)
 	{
 	  struct ld_plugin_symbol *s = &symtab->syms[j];
 	  free (s->name);
-	  if (s->comdat_key)
-	    free (s->comdat_key);
+	  free (s->comdat_key);
 	}
       free (symtab->syms);
       symtab->syms = NULL;
@@ -342,8 +341,7 @@ free_2 (void)
   claimed_files = NULL;
   num_claimed_files = 0;

-  if (arguments_file_name)
-    free (arguments_file_name);
+  free (arguments_file_name);
   arguments_file_name = NULL;
 }

-- 
1.7.4.1.299.ga459d

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2] Re: avoid useless if-before-free tests
  2011-03-08 14:21   ` [PATCH v2] " Jim Meyering
@ 2011-03-08 14:30     ` Rainer Orth
  2011-03-08 15:28       ` Ian Lance Taylor
  2011-03-08 17:03       ` Jim Meyering
  2011-03-08 17:54     ` [PATCH v3] " Jim Meyering
  1 sibling, 2 replies; 31+ messages in thread
From: Rainer Orth @ 2011-03-08 14:30 UTC (permalink / raw)
  To: Jim Meyering; +Cc: Joseph S. Myers, gcc-patches, java-patches, Ian Lance Taylor

Jim Meyering <jim@meyering.net> writes:

> I've taken the liberty of letting my editor remove trailing
> blanks in ChangeLog files.  I hope that's ok.  Also in ChangeLogs,
> I converted some leading 8-space (and 7-space) sequences to single TABs.

Please move this to a separate patch: this is completely unrelated to
the change at hand.  And please don't change the alignment of entries
with multiple email addresses.

> I found no ChangeLog for libgo and no other libgo-related entries.
> I suspect that means I should omit this change because it belongs upstream.

Indeed, cf. libgo/README*.  I've Cc'ed Ian who maintains this part of
GCC.

> For now, I've added an entry in the top-level ChangeLog file:
>  * libgo/runtime/go-select.c (__go_select):
> It's easier to remove than to add.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2] Re: avoid useless if-before-free tests
  2011-03-08 14:30     ` Rainer Orth
@ 2011-03-08 15:28       ` Ian Lance Taylor
  2011-03-08 15:36         ` Jakub Jelinek
  2011-03-08 17:03       ` Jim Meyering
  1 sibling, 1 reply; 31+ messages in thread
From: Ian Lance Taylor @ 2011-03-08 15:28 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Jim Meyering, Joseph S. Myers, gcc-patches, java-patches

Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

>> I found no ChangeLog for libgo and no other libgo-related entries.
>> I suspect that means I should omit this change because it belongs upstream.
>
> Indeed, cf. libgo/README*.  I've Cc'ed Ian who maintains this part of
> GCC.

Yes, libgo is upstream but in any case I'd prefer that you not make the
change to libgo/runtime/go-select.c.  I'm aware that free (NULL) is a
no-op but I wrote the code that way because it is extremely unlikely
that allocated_buffer != NULL.  I am simply inlining the common case.
Thanks.

Ian

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2] Re: avoid useless if-before-free tests
  2011-03-08 15:28       ` Ian Lance Taylor
@ 2011-03-08 15:36         ` Jakub Jelinek
  0 siblings, 0 replies; 31+ messages in thread
From: Jakub Jelinek @ 2011-03-08 15:36 UTC (permalink / raw)
  To: Ian Lance Taylor
  Cc: Rainer Orth, Jim Meyering, Joseph S. Myers, gcc-patches, java-patches

On Tue, Mar 08, 2011 at 07:28:37AM -0800, Ian Lance Taylor wrote:
> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> 
> >> I found no ChangeLog for libgo and no other libgo-related entries.
> >> I suspect that means I should omit this change because it belongs upstream.
> >
> > Indeed, cf. libgo/README*.  I've Cc'ed Ian who maintains this part of
> > GCC.
> 
> Yes, libgo is upstream but in any case I'd prefer that you not make the
> change to libgo/runtime/go-select.c.  I'm aware that free (NULL) is a
> no-op but I wrote the code that way because it is extremely unlikely
> that allocated_buffer != NULL.  I am simply inlining the common case.
> Thanks.

I guess such reason is sometimes legitimate, but it would be nice (and
better for generated code) to make it explicit in that case, i.e.
	if (__builtin_expect (allocated_buffer != NULL, 0))
		free (allocated_buffer);
could be a sign for anyone coming after Jim that this case is on purpose
and should be left as is.
allocated_buffer != NULL is normally predicted as true, not false.

	Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: avoid useless if-before-free tests
  2011-03-07 22:47     ` Joseph S. Myers
@ 2011-03-08 16:57       ` Dr Andrew John Hughes
  2011-03-08 17:07         ` Andrew Haley
  2011-03-08 17:17         ` Jim Meyering
  0 siblings, 2 replies; 31+ messages in thread
From: Dr Andrew John Hughes @ 2011-03-08 16:57 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Jim Meyering, gcc-patches, java-patches

On 22:47 Mon 07 Mar     , Joseph S. Myers wrote:
> On Mon, 7 Mar 2011, Dr Andrew John Hughes wrote:
> 
> > > http://gcc.gnu.org/codingconventions.html says Classpath changes should go 
> > > via Classpath upstream, not directly into GCC.  I don't know if that's 
> > > still accurate.
> > > 
> > 
> > That's still true.  This seems to be the first message I've received in this
> > thread, so I'm not even aware of what these changes are.  Were the earlier
> > messages not sent to this list?
> 
> The original patch went only to gcc-patches.
> 
> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00252.html
> 

Thanks for the link.

I'd like some explanation of why these changes are necessary before we start
adding them to Classpath.  Are we just assuming that all free implementations
will ignore NULL now?

With regards to fdlibm, there is a further upstream for this where
these changes should be made first.  fdlibm is also used by OpenJDK.

> -- 
> Joseph S. Myers
> joseph@codesourcery.com

-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and IcedTea
http://www.gnu.org/software/classpath
http://icedtea.classpath.org
PGP Key: F5862A37 (https://keys.indymedia.org/)
Fingerprint = EA30 D855 D50F 90CD F54D  0698 0713 C3ED F586 2A37

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2] Re: avoid useless if-before-free tests
  2011-03-08 14:30     ` Rainer Orth
  2011-03-08 15:28       ` Ian Lance Taylor
@ 2011-03-08 17:03       ` Jim Meyering
  2011-03-08 18:45         ` Rainer Orth
  1 sibling, 1 reply; 31+ messages in thread
From: Jim Meyering @ 2011-03-08 17:03 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Joseph S. Myers, gcc-patches, java-patches, Ian Lance Taylor

Rainer Orth wrote:
> Jim Meyering <jim@meyering.net> writes:
>> I've taken the liberty of letting my editor remove trailing
>> blanks in ChangeLog files.  I hope that's ok.  Also in ChangeLogs,
>> I converted some leading 8-space (and 7-space) sequences to single TABs.
>
> Please move this to a separate patch: this is completely unrelated to

It's moved.  I'll post v3 soon.

> the change at hand.  And please don't change the alignment of entries
> with multiple email addresses.

Changing 8-spaces to a TAB does not affect alignment when you're
looking at the ChangeLog file itself with standard tab setting.

Perhaps you looked at a hunk like the following and mistook it
for one that introduces an alignment change?

 2011-11-04  Eric Botcazou  <ebotcazou@adacore.com>
-            Jakub Jelinek  <jakub@redhat.com>
+	   Jakub Jelinek  <jakub@redhat.com>

It does not.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: avoid useless if-before-free tests
  2011-03-08 16:57       ` Dr Andrew John Hughes
@ 2011-03-08 17:07         ` Andrew Haley
  2011-03-08 17:17         ` Jim Meyering
  1 sibling, 0 replies; 31+ messages in thread
From: Andrew Haley @ 2011-03-08 17:07 UTC (permalink / raw)
  To: java-patches

On 03/08/2011 04:56 PM, Dr Andrew John Hughes wrote:

> With regards to fdlibm, there is a further upstream for this where
> these changes should be made first.  fdlibm is also used by OpenJDK.

Indeed.  We shouldn't touch fdlibm locally.

Andrew.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: avoid useless if-before-free tests
  2011-03-08 16:57       ` Dr Andrew John Hughes
  2011-03-08 17:07         ` Andrew Haley
@ 2011-03-08 17:17         ` Jim Meyering
  1 sibling, 0 replies; 31+ messages in thread
From: Jim Meyering @ 2011-03-08 17:17 UTC (permalink / raw)
  To: Dr Andrew John Hughes; +Cc: Joseph S. Myers, gcc-patches, java-patches

Dr Andrew John Hughes wrote:
> On 22:47 Mon 07 Mar     , Joseph S. Myers wrote:
>> On Mon, 7 Mar 2011, Dr Andrew John Hughes wrote:
>>
>> > > http://gcc.gnu.org/codingconventions.html says Classpath changes should go
>> > > via Classpath upstream, not directly into GCC.  I don't know if that's
>> > > still accurate.
>> > >
>> >
>> > That's still true.  This seems to be the first message I've received in this
>> > thread, so I'm not even aware of what these changes are.  Were the earlier
>> > messages not sent to this list?
>>
>> The original patch went only to gcc-patches.
>>
>> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00252.html
>>
>
> Thanks for the link.
>
> I'd like some explanation of why these changes are necessary before we start
> adding them to Classpath.  Are we just assuming that all free implementations
> will ignore NULL now?

IMHO, they're not officially "necessary", but rather nice to have,
since they eliminate code that is now obviously obsolete.
Those tests have been unnecessary for at least 5 years.
The efficiency (of removing the redundant test) is never the
issue for me, personally.  My main argument for making the change
is improved maintainability/readability:

  - less logic (esp. when the expression is more complicated)
  - no surprise (for reviewers who stopped using such tests years ago)
  - more compact, so more lines fit on a page/screen
  - removing unused code is always worthwhile

Sort of along the same lines as removing anachronistic casts of
malloc/calloc/realloc return values in C code.  No longer needed,
but many people continue to use them for no good reason.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH v3] Re: avoid useless if-before-free tests
  2011-03-08 14:21   ` [PATCH v2] " Jim Meyering
  2011-03-08 14:30     ` Rainer Orth
@ 2011-03-08 17:54     ` Jim Meyering
  2011-03-08 19:34       ` DJ Delorie
  2011-03-15  9:19       ` Janne Blomqvist
  1 sibling, 2 replies; 31+ messages in thread
From: Jim Meyering @ 2011-03-08 17:54 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: gcc-patches, java-patches, fortran

Jim Meyering wrote:
> Joseph S. Myers wrote:
> ...
>> We definitely don't want to make local changes to zlib for this sort of
>> issue, though importing a new upstream version of zlib (making sure the
>> local configure code still works) should be fine for 4.7.
>
> Thanks again for the feedback.
> I've omitted changes to the intl/, zlib/ and classpath/ directories
> reverted the problem you spotted, and added ChangeLog entries.
...

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.

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 2f694ff..f7ffa9f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -2,6 +2,7 @@

 	* gfortranspec.c (lang_specific_pre_link): Remove useless
 	if-before-free.
+	* misc.c (gfc_free): Likewise.

 2011-03-06  Paul Thomas  <pault@gcc.gnu.org>
 	    Jerry DeLisle  <jvdelisle@gcc.gnu.org>
diff --git a/gcc/fortran/misc.c b/gcc/fortran/misc.c
index 4dd186f..8a343a0 100644
--- a/gcc/fortran/misc.c
+++ b/gcc/fortran/misc.c
@@ -47,8 +47,7 @@ gfc_free (void *p)
 {
   /* The parentheses around free are needed in order to call not
      the redefined free of gfortran.h.  */
-  if (p != NULL)
-    (free) (p);
+  (free) (p);
 }



From 0d18b70a8821ab2fc58b5ed592ed611e05a29c7f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Mon, 3 Jan 2011 16:52:37 +0100
Subject: [PATCH 1/2] discourage unnecessary use of if before free

* README.Portability: Explain why "if (P) free (P)" is best avoided.
---
 gcc/README.Portability |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/gcc/README.Portability b/gcc/README.Portability
index 32a33e2..e099a3f 100644
--- a/gcc/README.Portability
+++ b/gcc/README.Portability
@@ -51,14 +51,24 @@ foo (bar, )
 needs to be coded in some other way.


-free and realloc
-----------------
+Avoid unnecessary test before free
+----------------------------------

-Some implementations crash upon attempts to free or realloc the null
-pointer.  Thus if mem might be null, you need to write
+Since SunOS 4 stopped being a reasonable portability target,
+(which happened around 2007) there has been no need to guard
+against "free (NULL)".  Thus, any guard like the following
+constitutes a redundant test:

-  if (mem)
-    free (mem);
+  if (P)
+    free (P);
+
+It is better to avoid the test.[*]
+Instead, simply free P, regardless of whether it is NULL.
+
+[*] However, if your profiling exposes a test like this in a
+performance-critical loop, say where P is nearly always NULL, and
+the cost of calling free on a NULL pointer would be prohibitively
+high, please let us know.


 Trigraphs
@@ -194,4 +204,3 @@ o Passing incorrect types to fprintf and friends.

 o Adding a function declaration for a module declared in another file to
   a .c file instead of to a .h file.
-
--
1.7.4.1.299.ga459d


From 6b02a3fdfc7169bd49a52465e990700844f68b22 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Tue, 8 Mar 2011 12:19:24 +0100
Subject: [PATCH 2/2] remove useless if-before-free tests

Change "if (E) free (E);" to "free (E);" everywhere except in the
libgo/, intl/, zlib/ and classpath/ directories.
Also transform equivalent variants like
"if (E != NULL) free (E);" and allow an extra cast on the
argument to free.  Otherwise, the tested and freed "E"
expressions must be identical, modulo white space.
---
 gcc/ChangeLog                       |   39 +++++++++++++++++
 gcc/ada/ChangeLog                   |    4 ++
 gcc/ada/initialize.c                |    3 +-
 gcc/c-family/ChangeLog              |    5 ++
 gcc/c-family/c-format.c             |    6 +--
 gcc/calls.c                         |   15 ++----
 gcc/cfgcleanup.c                    |    3 +-
 gcc/collect2.c                      |    3 +-
 gcc/config/i386/i386.c              |    3 +-
 gcc/config/mcore/mcore.c            |    3 +-
 gcc/coverage.c                      |    3 +-
 gcc/cp/ChangeLog                    |    4 ++
 gcc/cp/tree.c                       |    3 +-
 gcc/cse.c                           |    6 +--
 gcc/cselib.c                        |    3 +-
 gcc/df-core.c                       |   15 ++----
 gcc/fortran/ChangeLog               |    6 +++
 gcc/fortran/gfortranspec.c          |    5 +-
 gcc/fortran/misc.c                  |    3 +-
 gcc/function.c                      |    3 +-
 gcc/gcc.c                           |   15 ++----
 gcc/gcov.c                          |    6 +--
 gcc/gensupport.c                    |   12 ++----
 gcc/graphite-clast-to-gimple.c      |    3 +-
 gcc/graphite-sese-to-poly.c         |    3 +-
 gcc/haifa-sched.c                   |    3 +-
 gcc/ipa-prop.c                      |    3 +-
 gcc/ipa-pure-const.c                |    3 +-
 gcc/ipa-reference.c                 |    3 +-
 gcc/ira-costs.c                     |   15 ++----
 gcc/ira.c                           |    9 +---
 gcc/java/ChangeLog                  |    4 ++
 gcc/java/jcf-parse.c                |    3 +-
 gcc/matrix-reorg.c                  |    9 +---
 gcc/prefix.c                        |    3 +-
 gcc/profile.c                       |    3 +-
 gcc/reload1.c                       |   12 ++----
 gcc/sched-deps.c                    |    3 +-
 gcc/sel-sched-ir.c                  |    3 +-
 gcc/sese.c                          |    6 +--
 gcc/tree-data-ref.c                 |    6 +--
 gcc/tree-eh.c                       |    3 +-
 gcc/tree-ssa-coalesce.c             |    3 +-
 gcc/tree-ssa-live.c                 |    6 +--
 gcc/tree-ssa-loop-ivopts.c          |    6 +--
 gcc/tree-ssa-pre.c                  |    3 +-
 libcpp/ChangeLog                    |    7 +++
 libcpp/files.c                      |    3 +-
 libcpp/init.c                       |    3 +-
 libcpp/macro.c                      |    3 +-
 libcpp/pch.c                        |    9 +---
 libdecnumber/ChangeLog              |    9 ++++
 libdecnumber/decNumber.c            |   80 +++++++++++++++++-----------------
 libgfortran/ChangeLog               |   10 ++++
 libgfortran/intrinsics/move_alloc.c |    3 +-
 libgfortran/io/fbuf.c               |    3 +-
 libgfortran/io/format.c             |    3 +-
 libgfortran/io/open.c               |    3 +-
 libgfortran/io/unit.c               |    9 +---
 libgfortran/io/unix.c               |    3 +-
 libiberty/ChangeLog                 |   13 ++++++
 libiberty/cp-demint.c               |    6 +--
 libiberty/cplus-dem.c               |   13 +----
 libiberty/pex-common.c              |    9 +---
 libiberty/pex-msdos.c               |    6 +--
 libiberty/pex-win32.c               |   24 ++++-------
 libiberty/regex.c                   |   11 ++---
 libiberty/spaces.c                  |    5 +--
 libstdc++-v3/ChangeLog              |    5 ++
 libstdc++-v3/libsupc++/del_opnt.cc  |    3 +-
 lto-plugin/ChangeLog                |    4 ++
 lto-plugin/lto-plugin.c             |    6 +--
 72 files changed, 264 insertions(+), 272 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ece9ec1..520924b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,42 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	Remove useless if-before-free tests.
+	* calls.c (expand_call, save_area): Likewise.
+	* cfgcleanup.c (try_forward_edges): Likewise.
+	* collect2.c (collect_execute): Likewise.
+	* config/i386/i386.c (ix86_valid_target_attribute_tree): Likewise.
+	* config/mcore/mcore.c (mcore_expand_prolog): Likewise.
+	* coverage.c (coverage_checksum_string): Likewise.
+	* cse.c (init_cse_reg_info, delete_trivially_dead_insns): Likewise.
+	* cselib.c (cselib_init): Likewise.
+	* df-core.c (rest_of_handle_df_finish, df_analyze): Likewise.
+	(df_set_clean_cfg): Likewise.
+	* function.c (free_after_compilation): Likewise.
+	* gcc.c (do_spec_1, main): Likewise.
+	* gcov.c (create_file_names): Likewise.
+	* gensupport.c (identify_predicable_attribute): Likewise.
+	* graphite-clast-to-gimple.c (save_clast_name_index): Likewise.
+	* graphite-sese-to-poly.c (free_data_refs_aux): Likewise.
+	* haifa-sched.c (haifa_finish_h_i_d): Likewise.
+	* ipa-prop.c (ipa_free_node_params_substructures): Likewise.
+	* ipa-pure-const.c (local_pure_const): Likewise.
+	* ipa-reference.c (propagate): Likewise.
+	* ira-costs.c (free_ira_costs): Likewise.
+	* ira.c (free_register_move_costs, build_insn_chain): Likewise.
+	* matrix-reorg.c (mat_free): Likewise.
+	* prefix.c (get_key_value): Likewise.
+	* profile.c (compute_value_histograms): Likewise.
+	* reload1.c (free_reg_equiv): Likewise.
+	* sched-deps.c (free_deps): Likewise.
+	* sel-sched-ir.c (fence_clear): Likewise.
+	* sese.c (set_rename, if_region_set_false_region): Likewise.
+	* tree-data-ref.c (free_rdg): Likewise.
+	* tree-eh.c (lower_try_finally): Likewise.
+	* tree-ssa-coalesce.c (delete_coalesce_list): Likewise.
+	* tree-ssa-live.c (delete_var_map): Likewise.
+	* tree-ssa-loop-ivopts.c (free_loop_data): Likewise.
+	* tree-ssa-pre.c (phi_trans_add): Likewise.
+
 2011-03-08  Jakub Jelinek  <jakub@redhat.com>

 	PR tree-optimization/48022
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index defad83..e4996ab 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* initialize.c (__gnat_initialize): Remove useless if-before-free.
+
 2011-02-14  Eric Botcazou  <ebotcazou@adacore.com>

 	* gcc-interface/misc.c (gnat_init_options): Do not concatenate -I and
diff --git a/gcc/ada/initialize.c b/gcc/ada/initialize.c
index 32ea0e5..e2ad904 100644
--- a/gcc/ada/initialize.c
+++ b/gcc/ada/initialize.c
@@ -217,8 +217,7 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)

 		     FindClose (hDir);

-		     if (dir != NULL)
-		       free (dir);
+		     free (dir);
 		   }
 	       }
 	     else
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 60fc08f..8bc6110 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* c-format.c (init_dollar_format_checking): Remove useless
+	if-before-free.
+
 2011-03-07  Nathan Froyd  <froydnj@codesourcery.com>

 	PR c/47786
diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c
index 85831eb..2f8887f1 100644
--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -1107,10 +1107,8 @@ init_dollar_format_checking (int first_arg_num, tree params)
     }
   if (dollar_arguments_alloc < dollar_arguments_count)
     {
-      if (dollar_arguments_used)
-	free (dollar_arguments_used);
-      if (dollar_arguments_pointer_p)
-	free (dollar_arguments_pointer_p);
+      free (dollar_arguments_used);
+      free (dollar_arguments_pointer_p);
       dollar_arguments_alloc = dollar_arguments_count;
       dollar_arguments_used = XNEWVEC (char, dollar_arguments_alloc);
       dollar_arguments_pointer_p = XNEWVEC (char, dollar_arguments_alloc);
diff --git a/gcc/calls.c b/gcc/calls.c
index f539f66..de953d0 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -2549,8 +2549,7 @@ expand_call (tree exp, rtx target, int ignore)
 		  highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
 						     needed);
 #endif
-		  if (stack_usage_map_buf)
-		    free (stack_usage_map_buf);
+		  free (stack_usage_map_buf);
 		  stack_usage_map_buf = XNEWVEC (char, highest_outgoing_arg_in_use);
 		  stack_usage_map = stack_usage_map_buf;

@@ -2655,8 +2654,7 @@ expand_call (tree exp, rtx target, int ignore)
 		    = stack_arg_under_construction;
 		  stack_arg_under_construction = 0;
 		  /* Make a new map for the new argument list.  */
-		  if (stack_usage_map_buf)
-		    free (stack_usage_map_buf);
+		  free (stack_usage_map_buf);
 		  stack_usage_map_buf = XCNEWVEC (char, highest_outgoing_arg_in_use);
 		  stack_usage_map = stack_usage_map_buf;
 		  highest_outgoing_arg_in_use = 0;
@@ -3148,8 +3146,7 @@ expand_call (tree exp, rtx target, int ignore)

       /* Free up storage we no longer need.  */
       for (i = 0; i < num_actuals; ++i)
-	if (args[i].aligned_regs)
-	  free (args[i].aligned_regs);
+	free (args[i].aligned_regs);

       insns = get_insns ();
       end_sequence ();
@@ -3204,8 +3201,7 @@ expand_call (tree exp, rtx target, int ignore)

   currently_expanding_call--;

-  if (stack_usage_map_buf)
-    free (stack_usage_map_buf);
+  free (stack_usage_map_buf);

   return target;
 }
@@ -3966,8 +3962,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
       stack_usage_map = initial_stack_usage_map;
     }

-  if (stack_usage_map_buf)
-    free (stack_usage_map_buf);
+  free (stack_usage_map_buf);

   return value;

diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index aaa0ea5..dda4d52 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -650,8 +650,7 @@ try_forward_edges (int mode, basic_block b)
       ei_next (&ei);
     }

-  if (threaded_edges)
-    free (threaded_edges);
+  free (threaded_edges);
   return changed;
 }
 \f
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 42e35b6..9eac3cb 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -2092,8 +2092,7 @@ collect_execute (const char *prog, char **argv, const char *outname,
 	fatal (errmsg);
     }

-  if (response_arg)
-    free (response_arg);
+  free (response_arg);

   return pex;
 }
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 82d999b..936c3cf 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4765,8 +4765,7 @@ ix86_valid_target_attribute_tree (tree args)

       /* Free up memory allocated to hold the strings */
       for (i = 0; i < IX86_FUNCTION_SPECIFIC_MAX; i++)
-	if (option_strings[i])
-	  free (option_strings[i]);
+	free (option_strings[i]);
     }

   return t;
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index 8118276..f527452 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -1978,8 +1978,7 @@ mcore_expand_prolog (void)
       
       gcc_assert (GET_CODE (x) == SYMBOL_REF);
       
-      if (mcore_current_function_name)
-	free (mcore_current_function_name);
+      free (mcore_current_function_name);
       
       mcore_current_function_name = xstrdup (XSTR (x, 0));
       
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 5da5464..b4da548 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -521,8 +521,7 @@ coverage_checksum_string (unsigned chksum, const char *string)
     }

   chksum = crc32_string (chksum, string);
-  if (dup)
-    free (dup);
+  free (dup);

   return chksum;
 }
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f18ce9c..6cfa362 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* tree.c (cxx_printable_name_internal): Remove useless if-before-free.
+
 2011-03-07  Jason Merrill  <jason@redhat.com>

 	PR c++/48003
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 56639ff..91e7078 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1506,8 +1506,7 @@ cxx_printable_name_internal (tree decl, int v, bool translate)
       gcc_assert (uid_ring[ring_counter] != DECL_UID (current_function_decl));
     }

-  if (print_ring[ring_counter])
-    free (print_ring[ring_counter]);
+  free (print_ring[ring_counter]);

   print_ring[ring_counter] = xstrdup (lang_decl_name (decl, v, translate));
   uid_ring[ring_counter] = DECL_UID (decl);
diff --git a/gcc/cse.c b/gcc/cse.c
index f7b477c..d83b38a 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -796,8 +796,7 @@ init_cse_reg_info (unsigned int nregs)
 	}

       /* Reallocate the table with NEW_SIZE entries.  */
-      if (cse_reg_info_table)
-	free (cse_reg_info_table);
+      free (cse_reg_info_table);
       cse_reg_info_table = XNEWVEC (struct cse_reg_info, new_size);
       cse_reg_info_table_size = new_size;
       cse_reg_info_table_first_uninitialized = 0;
@@ -6975,8 +6974,7 @@ delete_trivially_dead_insns (rtx insns, int nreg)
 		df_insn_rescan (insn);
 	      }
 	  }
-      if (replacements)
-	free (replacements);
+      free (replacements);
     }

   if (dump_file && ndead)
diff --git a/gcc/cselib.c b/gcc/cselib.c
index c142d67..ce8564b 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -2429,8 +2429,7 @@ cselib_init (int record_what)
   if (!reg_values || reg_values_size < cselib_nregs
       || (reg_values_size > 10 && reg_values_size > cselib_nregs * 4))
     {
-      if (reg_values)
-	free (reg_values);
+      free (reg_values);
       /* Some space for newly emit instructions so we don't end up
 	 reallocating in between passes.  */
       reg_values_size = cselib_nregs + (63 + cselib_nregs) / 16;
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 36270bf..2860521 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -811,10 +811,8 @@ rest_of_handle_df_finish (void)
       dflow->problem->free_fun ();
     }

-  if (df->postorder)
-    free (df->postorder);
-  if (df->postorder_inverted)
-    free (df->postorder_inverted);
+  free (df->postorder);
+  free (df->postorder_inverted);
   free (df->hard_regs_live_count);
   free (df);
   df = NULL;
@@ -1183,10 +1181,8 @@ df_analyze (void)
   bool everything;
   int i;

-  if (df->postorder)
-    free (df->postorder);
-  if (df->postorder_inverted)
-    free (df->postorder_inverted);
+  free (df->postorder);
+  free (df->postorder_inverted);
   df->postorder = XNEWVEC (int, last_basic_block);
   df->postorder_inverted = XNEWVEC (int, last_basic_block);
   df->n_blocks = post_order_compute (df->postorder, true, true);
@@ -1726,8 +1722,7 @@ df_check_cfg_clean (void)
 static void
 df_set_clean_cfg (void)
 {
-  if (saved_cfg)
-    free (saved_cfg);
+  free (saved_cfg);
   saved_cfg = df_compute_cfg_image ();
 }

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index a479ef6..f7ffa9f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* gfortranspec.c (lang_specific_pre_link): Remove useless
+	if-before-free.
+	* misc.c (gfc_free): Likewise.
+
 2011-03-06  Paul Thomas  <pault@gcc.gnu.org>
 	    Jerry DeLisle  <jvdelisle@gcc.gnu.org>

diff --git a/gcc/fortran/gfortranspec.c b/gcc/fortran/gfortranspec.c
index 2d732fd..4d939a0 100644
--- a/gcc/fortran/gfortranspec.c
+++ b/gcc/fortran/gfortranspec.c
@@ -472,9 +472,8 @@ For more information about these matters, see the file named COPYING\n\n"));
 int
 lang_specific_pre_link (void)
 {
-  if (spec_file)
-    free (spec_file);
-  else if (library)
+  free (spec_file);
+  if (spec_file == NULL && library)
     do_spec ("%:include(libgfortran.spec)");

   return 0;
diff --git a/gcc/fortran/misc.c b/gcc/fortran/misc.c
index 4dd186f..8a343a0 100644
--- a/gcc/fortran/misc.c
+++ b/gcc/fortran/misc.c
@@ -47,8 +47,7 @@ gfc_free (void *p)
 {
   /* The parentheses around free are needed in order to call not
      the redefined free of gfortran.h.  */
-  if (p != NULL)
-    (free) (p);
+  (free) (p);
 }


diff --git a/gcc/function.c b/gcc/function.c
index 19b480d..d5efa4a 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -211,8 +211,7 @@ free_after_compilation (struct function *f)
   prologue_insn_hash = NULL;
   epilogue_insn_hash = NULL;

-  if (crtl->emit.regno_pointer_align)
-    free (crtl->emit.regno_pointer_align);
+  free (crtl->emit.regno_pointer_align);

   memset (crtl, 0, sizeof (struct rtl_data));
   f->eh = NULL;
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 75f522e..6906089 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4782,8 +4782,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
 		    t->filename_length = temp_filename_length;
 		  }

-		if (saved_suffix)
-		  free (saved_suffix);
+		free (saved_suffix);

 		obstack_grow (&obstack, t->filename, t->filename_length);
 		delete_this_arg = 1;
@@ -6700,12 +6699,10 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
 	    {
 	      if (compare_debug)
 		{
-		  if (debug_check_temp_file[0])
-		    free (debug_check_temp_file[0]);
+		  free (debug_check_temp_file[0]);
 		  debug_check_temp_file[0] = NULL;

-		  if (debug_check_temp_file[1])
-		    free (debug_check_temp_file[1]);
+		  free (debug_check_temp_file[1]);
 		  debug_check_temp_file[1] = NULL;
 		}

@@ -6749,12 +6746,10 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"

 	      if (compare_debug)
 		{
-		  if (debug_check_temp_file[0])
-		    free (debug_check_temp_file[0]);
+		  free (debug_check_temp_file[0]);
 		  debug_check_temp_file[0] = NULL;

-		  if (debug_check_temp_file[1])
-		    free (debug_check_temp_file[1]);
+		  free (debug_check_temp_file[1]);
 		  debug_check_temp_file[1] = NULL;
 		}
 	    }
diff --git a/gcc/gcov.c b/gcc/gcov.c
index 2fbeaf5..dd71224 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -661,10 +661,8 @@ create_file_names (const char *file_name)
   int base;

   /* Free previous file names.  */
-  if (bbg_file_name)
-    free (bbg_file_name);
-  if (da_file_name)
-    free (da_file_name);
+  free (bbg_file_name);
+  free (da_file_name);
   da_file_name = bbg_file_name = NULL;
   bbg_file_time = 0;
   bbg_stamp = 0;
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index e81682c..1c308c7 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -350,8 +350,7 @@ identify_predicable_attribute (void)
   if (p_true == NULL || strchr (++p_true, ',') != NULL)
     {
       error_with_line (elem->lineno, "attribute `predicable' is not a boolean");
-      if (p_false)
-        free (p_false);
+      free (p_false);
       return;
     }
   p_true[-1] = '\0';
@@ -367,15 +366,13 @@ identify_predicable_attribute (void)

     case CONST:
       error_with_line (elem->lineno, "attribute `predicable' cannot be const");
-      if (p_false)
-	free (p_false);
+      free (p_false);
       return;

     default:
       error_with_line (elem->lineno,
 		       "attribute `predicable' must have a constant default");
-      if (p_false)
-	free (p_false);
+      free (p_false);
       return;
     }

@@ -387,8 +384,7 @@ identify_predicable_attribute (void)
     {
       error_with_line (elem->lineno,
 		       "unknown value `%s' for `predicable' attribute", value);
-      if (p_false)
-	free (p_false);
+      free (p_false);
     }
 }

diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 47a03d5..83c0d6d 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -114,8 +114,7 @@ save_clast_name_index (htab_t index_table, const char *name, int index)

   if (slot)
     {
-      if (*slot)
-	free (*slot);
+      free (*slot);

       *slot = new_clast_name_index (name, index);
     }
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 064ded3..7474be0 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -190,8 +190,7 @@ free_data_refs_aux (VEC (data_reference_p, heap) *datarefs)
       {
 	base_alias_pair *bap = (base_alias_pair *)(dr->aux);

-	if (bap->alias_set)
-	  free (bap->alias_set);
+	free (bap->alias_set);

 	free (bap);
 	dr->aux = NULL;
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index e16561f..67cef40 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -5556,8 +5556,7 @@ haifa_finish_h_i_d (void)

   FOR_EACH_VEC_ELT (haifa_insn_data_def, h_i_d, i, data)
     {
-      if (data->reg_pressure != NULL)
-	free (data->reg_pressure);
+      free (data->reg_pressure);
       for (use = data->reg_use_list; use != NULL; use = next)
 	{
 	  next = use->next_insn_use;
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 82599f1..58f3303d 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -1893,8 +1893,7 @@ ipa_free_all_edge_args (void)
 void
 ipa_free_node_params_substructures (struct ipa_node_params *info)
 {
-  if (info->params)
-    free (info->params);
+  free (info->params);

   memset (info, 0, sizeof (*info));
 }
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 3b4cc02..6a8b391 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1667,8 +1667,7 @@ local_pure_const (void)
 		 lang_hooks.decl_printable_name (current_function_decl,
 						 2));
     }
-  if (l)
-    free (l);
+  free (l);
   if (changed)
     return execute_fixup_cfg ();
   else
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index f874a2e..40fa6bc 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -913,8 +913,7 @@ propagate (void)
 				  node_g->statics_written);
 	    }
 	}
-      if (node_info)
-	free (node_info);
+      free (node_info);
       if (node->aux)
 	{
 	  free (node->aux);
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 2329613..2afddca 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -1619,22 +1619,17 @@ free_ira_costs (void)
 {
   int i;

-  if (init_cost != NULL)
-    free (init_cost);
+  free (init_cost);
   init_cost = NULL;
   for (i = 0; i < MAX_RECOG_OPERANDS; i++)
     {
-      if (op_costs[i] != NULL)
-	free (op_costs[i]);
-      if (this_op_costs[i] != NULL)
-	free (this_op_costs[i]);
+      free (op_costs[i]);
+      free (this_op_costs[i]);
       op_costs[i] = this_op_costs[i] = NULL;
     }
-  if (temp_costs != NULL)
-    free (temp_costs);
+  free (temp_costs);
   temp_costs = NULL;
-  if (cost_classes != NULL)
-    free (cost_classes);
+  free (cost_classes);
   cost_classes = NULL;
 }

diff --git a/gcc/ira.c b/gcc/ira.c
index 68d47fb..b8a72a3 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -1150,10 +1150,8 @@ free_register_move_costs (void)

   for (mode = 0; mode < MAX_MACHINE_MODE; mode++)
     {
-      if (ira_may_move_in_cost[mode] != NULL)
-	free (ira_may_move_in_cost[mode]);
-      if (ira_may_move_out_cost[mode] != NULL)
-	free (ira_may_move_out_cost[mode]);
+      free (ira_may_move_in_cost[mode]);
+      free (ira_may_move_out_cost[mode]);
       ira_register_move_cost[mode] = NULL;
       ira_may_move_in_cost[mode] = NULL;
       ira_may_move_out_cost[mode] = NULL;
@@ -3036,8 +3034,7 @@ build_insn_chain (void)
     }

   for (i = 0; i < (unsigned int) max_regno; i++)
-    if (live_subregs[i])
-      free (live_subregs[i]);
+    free (live_subregs[i]);

   reload_insn_chain = c;
   *p = NULL;
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 5b95565..09ef878 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* jcf-parse.c (java_parse_file): Remove useless if-before-free.
+
 2011-02-13  Joseph Myers  <joseph@codesourcery.com>

 	* jvspec.c (jvgenmain_spec): Remove %{a*}.
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index d10791f..2a1d522 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -1843,8 +1843,7 @@ java_parse_file (void)
       list = next;
     }

-  if (file_list != NULL)
-    free (file_list);
+  free (file_list);

   if (filename_count == 0)
     warning (0, "no input file specified");
diff --git a/gcc/matrix-reorg.c b/gcc/matrix-reorg.c
index c303143..8ea6e84 100644
--- a/gcc/matrix-reorg.c
+++ b/gcc/matrix-reorg.c
@@ -529,12 +529,9 @@ mat_free (void *e)
   if (!mat)
     return;

-  if (mat->free_stmts)
-    free (mat->free_stmts);
-  if (mat->dim_hot_level)
-    free (mat->dim_hot_level);
-  if (mat->malloc_for_level)
-    free (mat->malloc_for_level);
+  free (mat->free_stmts);
+  free (mat->dim_hot_level);
+  free (mat->malloc_for_level);
 }

 /* Find all potential matrices.
diff --git a/gcc/prefix.c b/gcc/prefix.c
index c72203c..0167f9c 100644
--- a/gcc/prefix.c
+++ b/gcc/prefix.c
@@ -103,8 +103,7 @@ get_key_value (char *key)
   if (prefix == 0)
     prefix = std_prefix;

-  if (temp)
-    free (temp);
+  free (temp);

   return prefix;
 }
diff --git a/gcc/profile.c b/gcc/profile.c
index 2334101..ed264bc 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -828,8 +828,7 @@ compute_value_histograms (histogram_values values)
     }

   for (t = 0; t < GCOV_N_VALUE_COUNTERS; t++)
-    if (histogram_counts[t])
-      free (histogram_counts[t]);
+    free (histogram_counts[t]);
 }

 /* The entry basic block will be moved around so that it has index=1,
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 3d58e58..d07febd 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -4206,19 +4206,15 @@ free_reg_equiv (void)
 {
   int i;

-  if (reg_equiv_constant)
-    free (reg_equiv_constant);
-  if (reg_equiv_invariant)
-    free (reg_equiv_invariant);
+  free (reg_equiv_constant);
+  free (reg_equiv_invariant);
   reg_equiv_constant = 0;
   reg_equiv_invariant = 0;
   VEC_free (rtx, gc, reg_equiv_memory_loc_vec);
   reg_equiv_memory_loc = 0;

-  if (offsets_known_at)
-    free (offsets_known_at);
-  if (offsets_at)
-    free (offsets_at);
+  free (offsets_known_at);
+  free (offsets_at);
   offsets_at = 0;
   offsets_known_at = 0;

diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 7293fc3..240e0e3 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -3550,8 +3550,7 @@ free_deps (struct deps_desc *deps)

   /* As we initialize reg_last lazily, it is possible that we didn't allocate
      it at all.  */
-  if (deps->reg_last)
-    free (deps->reg_last);
+  free (deps->reg_last);
   deps->reg_last = NULL;

   deps = NULL;
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index b88dad1..fc31d19 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -580,8 +580,7 @@ fence_clear (fence_t f)
   gcc_assert ((s != NULL && dc != NULL && tc != NULL)
 	      || (s == NULL && dc == NULL && tc == NULL));

-  if (s != NULL)
-    free (s);
+  free (s);

   if (dc != NULL)
     delete_deps_context (dc);
diff --git a/gcc/sese.c b/gcc/sese.c
index bfb0276..3ce83b9 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -449,8 +449,7 @@ set_rename (htab_t rename_map, tree old_name, tree expr)
   if (!slot)
     return;

-  if (*slot)
-    free (*slot);
+  free (*slot);

   *slot = new_rename_map_elt (old_name, expr);
 }
@@ -676,8 +675,7 @@ if_region_set_false_region (ifsese if_region, sese region)

   SESE_EXIT (region) = false_edge;

-  if (if_region->false_region)
-    free (if_region->false_region);
+  free (if_region->false_region);
   if_region->false_region = region;

   if (slot)
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 54cb46c..ef7c414 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -5085,11 +5085,9 @@ free_rdg (struct graph *rdg)
       struct graph_edge *e;

       for (e = v->succ; e; e = e->succ_next)
-	if (e->data)
-	  free (e->data);
+	free (e->data);

-      if (v->data)
-	free (v->data);
+      free (v->data);
     }

   htab_delete (rdg->indices);
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index f189b9b..948a796 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1617,8 +1617,7 @@ lower_try_finally (struct leh_state *state, gimple tp)
     }

   VEC_free (tree, heap, this_tf.dest_array);
-  if (this_tf.goto_queue)
-    free (this_tf.goto_queue);
+  free (this_tf.goto_queue);
   if (this_tf.goto_queue_map)
     pointer_map_destroy (this_tf.goto_queue_map);

diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index e7490e6..2dfe37e 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -242,8 +242,7 @@ delete_coalesce_list (coalesce_list_p cl)
 {
   gcc_assert (cl->cost_one_list == NULL);
   htab_delete (cl->list);
-  if (cl->sorted)
-    free (cl->sorted);
+  free (cl->sorted);
   gcc_assert (cl->num_sorted == 0);
   free (cl);
 }
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 0441df6..4a8a4eb 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -157,10 +157,8 @@ delete_var_map (var_map map)
 {
   var_map_base_fini (map);
   partition_delete (map->var_partition);
-  if (map->partition_to_view)
-    free (map->partition_to_view);
-  if (map->view_to_partition)
-    free (map->view_to_partition);
+  free (map->partition_to_view);
+  free (map->view_to_partition);
   free (map);
 }

diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 479b46f..723812f 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -6254,8 +6254,7 @@ free_loop_data (struct ivopts_data *data)
       struct version_info *info;

       info = ver_info (data, i);
-      if (info->iv)
-	free (info->iv);
+      free (info->iv);
       info->iv = NULL;
       info->has_nonlin_use = false;
       info->preserve_biv = false;
@@ -6282,8 +6281,7 @@ free_loop_data (struct ivopts_data *data)
     {
       struct iv_cand *cand = iv_cand (data, i);

-      if (cand->iv)
-	free (cand->iv);
+      free (cand->iv);
       if (cand->depends_on)
 	BITMAP_FREE (cand->depends_on);
       free (cand);
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index f246643..f13adaf 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -580,8 +580,7 @@ phi_trans_add (pre_expr e, pre_expr v, basic_block pred)

   slot = htab_find_slot_with_hash (phi_translate_table, new_pair,
 				   new_pair->hashcode, INSERT);
-  if (*slot)
-    free (*slot);
+  free (*slot);
   *slot = (void *) new_pair;
 }

diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index e90f753..bc4a7e9 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,10 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* files.c (destroy_cpp_file): Remove useless if-before-free.
+	* init.c (cpp_destroy): Likewise.
+	* macro.c (replace_args): Likewise.
+	* pch.c (cpp_valid_state): Likewise.
+
 2011-11-04  Eric Botcazou  <ebotcazou@adacore.com>
             Jakub Jelinek  <jakub@redhat.com>

diff --git a/libcpp/files.c b/libcpp/files.c
index 456c0b0..f464fea 100644
--- a/libcpp/files.c
+++ b/libcpp/files.c
@@ -996,8 +996,7 @@ make_cpp_file (cpp_reader *pfile, cpp_dir *dir, const char *fname)
 static void
 destroy_cpp_file (_cpp_file *file)
 {
-  if (file->buffer_start)
-    free ((void *) file->buffer_start);
+  free ((void *) file->buffer_start);
   free ((void *) file->name);
   free (file);
 }
diff --git a/libcpp/init.c b/libcpp/init.c
index cfc16e8..ae1c0b8 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -258,8 +258,7 @@ cpp_destroy (cpp_reader *pfile)
   while (CPP_BUFFER (pfile) != NULL)
     _cpp_pop_buffer (pfile);

-  if (pfile->out.base)
-    free (pfile->out.base);
+  free (pfile->out.base);

   if (pfile->macro_buffer)
     {
diff --git a/libcpp/macro.c b/libcpp/macro.c
index d9324a3..eba2349 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -1064,8 +1064,7 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro, macro_arg

   /* Free the expanded arguments.  */
   for (i = 0; i < macro->paramc; i++)
-    if (args[i].expanded)
-      free (args[i].expanded);
+    free (args[i].expanded);

   push_ptoken_context (pfile, node, buff, first, dest - first);
 }
diff --git a/libcpp/pch.c b/libcpp/pch.c
index 00b7794..d278f14 100644
--- a/libcpp/pch.c
+++ b/libcpp/pch.c
@@ -713,12 +713,9 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
   return -1;

  fail:
-  if (namebuf != NULL)
-    free (namebuf);
-  if (undeftab != NULL)
-    free (undeftab);
-  if (nl.defs != NULL)
-    free (nl.defs);
+  free (namebuf);
+  free (undeftab);
+  free (nl.defs);
   return 1;
 }

diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog
index 101cda9..bcafd17 100644
--- a/libdecnumber/ChangeLog
+++ b/libdecnumber/ChangeLog
@@ -1,3 +1,12 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* decNumber.c (decNumberFromString): Remove useless
+	if-before-free test.
+	(decNumberCompareTotalMag, decNumberExp, decNumberFMA): Likewise.
+	(decNumberLn, decNumberLog10, decNumberPower): Likewise.
+	(decNumberReduce, decNumberSquareRoot, decAddOp): Likewise.
+	(decDivideOp, NEEDTWO, decExpOp, LN2): Likewise.
+
 2010-11-24  Nathan Froyd  <froydnj@codesourcery.com>

 	* dconfig.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Delete.
diff --git a/libdecnumber/decNumber.c b/libdecnumber/decNumber.c
index d097cab..cf2d32e 100644
--- a/libdecnumber/decNumber.c
+++ b/libdecnumber/decNumber.c
@@ -711,7 +711,7 @@ decNumber * decNumberFromString(decNumber *dn, const char chars[],
     /* decNumberShow(dn); */
     } while(0); 			/* [for break] */

-  if (allocres!=NULL) free(allocres);	/* drop any storage used */
+  free(allocres);	/* drop any storage used */
   if (status!=0) decStatus(dn, status, set);
   return dn;
   } /* decNumberFromString */
@@ -970,8 +970,8 @@ decNumber * decNumberCompareTotalMag(decNumber *res, const decNumber *lhs,
     decCompareOp(res, lhs, rhs, set, COMPTOTAL, &status);
     } while(0); 			/* end protected */

-  if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
-  if (allocbufb!=NULL) free(allocbufb); /* .. */
+  free(allocbufa); /* drop any storage used */
+  free(allocbufb); /* .. */
   if (status!=0) decStatus(res, status, set);
   return res;
   } /* decNumberCompareTotalMag */
@@ -1074,7 +1074,7 @@ decNumber * decNumberExp(decNumber *res, const decNumber *rhs,
     } while(0); 			/* end protected */

   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);	/* drop any storage used */
+  free(allocrhs);	/* drop any storage used */
   #endif
   /* apply significant status */
   if (status!=0) decStatus(res, status, set);
@@ -1169,7 +1169,7 @@ decNumber * decNumberFMA(decNumber *res, const decNumber *lhs,
     decAddOp(res, acc, fhs, set, 0, &status);
     } while(0); 			/* end protected */

-  if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
+  free(allocbufa); /* drop any storage used */
   if (status!=0) decStatus(res, status, set);
   #if DECCHECK
   decCheckInexact(res, set);
@@ -1296,7 +1296,7 @@ decNumber * decNumberLn(decNumber *res, const decNumber *rhs,
     } while(0); 			/* end protected */

   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);	/* drop any storage used */
+  free(allocrhs);	/* drop any storage used */
   #endif
   /* apply significant status */
   if (status!=0) decStatus(res, status, set);
@@ -1509,10 +1509,10 @@ decNumber * decNumberLog10(decNumber *res, const decNumber *rhs,
     decDivideOp(res, a, b, &aset, DIVIDE, &status); /* into result */
     } while(0); 			/* [for break] */

-  if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
-  if (allocbufb!=NULL) free(allocbufb); /* .. */
+  free(allocbufa); /* drop any storage used */
+  free(allocbufb); /* .. */
   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);	/* .. */
+  free(allocrhs);	/* .. */
   #endif
   /* apply significant status */
   if (status!=0) decStatus(res, status, set);
@@ -2253,11 +2253,11 @@ decNumber * decNumberPower(decNumber *res, const decNumber *lhs,
     #endif
     } while(0); 			/* end protected */

-  if (allocdac!=NULL) free(allocdac);	/* drop any storage used */
-  if (allocinv!=NULL) free(allocinv);	/* .. */
+  free(allocdac);	/* drop any storage used */
+  free(allocinv);	/* .. */
   #if DECSUBSET
-  if (alloclhs!=NULL) free(alloclhs);	/* .. */
-  if (allocrhs!=NULL) free(allocrhs);	/* .. */
+  free(alloclhs);	/* .. */
+  free(allocrhs);	/* .. */
   #endif
   if (status!=0) decStatus(res, status, set);
   #if DECCHECK
@@ -2349,7 +2349,7 @@ decNumber * decNumberReduce(decNumber *res, const decNumber *rhs,
     } while(0); 			     /* end protected */

   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);	     /* .. */
+  free(allocrhs);	     /* .. */
   #endif
   if (status!=0) decStatus(res, status, set);/* then report status */
   return res;
@@ -3111,11 +3111,11 @@ decNumber * decNumberSquareRoot(decNumber *res, const decNumber *rhs,
     decNumberCopy(res, a);		     /* a is now the result */
     } while(0); 			     /* end protected */

-  if (allocbuff!=NULL) free(allocbuff);      /* drop any storage used */
-  if (allocbufa!=NULL) free(allocbufa);      /* .. */
-  if (allocbufb!=NULL) free(allocbufb);      /* .. */
+  free(allocbuff);      /* drop any storage used */
+  free(allocbufa);      /* .. */
+  free(allocbufb);      /* .. */
   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);	     /* .. */
+  free(allocrhs);	     /* .. */
   #endif
   if (status!=0) decStatus(res, status, set);/* then report status */
   #if DECCHECK
@@ -4130,10 +4130,10 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs,
       }
     } while(0); 			     /* end protected */

-  if (allocacc!=NULL) free(allocacc);	     /* drop any storage used */
+  free(allocacc);	     /* drop any storage used */
   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);	     /* .. */
-  if (alloclhs!=NULL) free(alloclhs);	     /* .. */
+  free(allocrhs);	     /* .. */
+  free(alloclhs);	     /* .. */
   #endif
   return res;
   } /* decAddOp */
@@ -4782,11 +4782,11 @@ static decNumber * decDivideOp(decNumber *res,
     #endif
     } while(0); 			     /* end protected */

-  if (varalloc!=NULL) free(varalloc);	/* drop any storage used */
-  if (allocacc!=NULL) free(allocacc);	/* .. */
+  free(varalloc);	/* drop any storage used */
+  free(allocacc);	/* .. */
   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);	/* .. */
-  if (alloclhs!=NULL) free(alloclhs);	/* .. */
+  free(allocrhs);	/* .. */
+  free(alloclhs);	/* .. */
   #endif
   return res;
   } /* decDivideOp */
@@ -5127,14 +5127,14 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs,
     decFinish(res, set, &residue, status);   /* final cleanup */
     } while(0); 			/* end protected */

-  if (allocacc!=NULL) free(allocacc);	/* drop any storage used */
+  free(allocacc);	/* drop any storage used */
   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);	/* .. */
-  if (alloclhs!=NULL) free(alloclhs);	/* .. */
+  free(allocrhs);	/* .. */
+  free(alloclhs);	/* .. */
   #endif
   #if FASTMUL
-  if (allocrhi!=NULL) free(allocrhi);	/* .. */
-  if (alloclhi!=NULL) free(alloclhi);	/* .. */
+  free(allocrhi);	/* .. */
+  free(alloclhi);	/* .. */
   #endif
   return res;
   } /* decMultiplyOp */
@@ -5483,9 +5483,9 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs,
     decFinish(res, set, &residue, status);	 /* cleanup/set flags */
     } while(0); 			/* end protected */

-  if (allocrhs !=NULL) free(allocrhs);	/* drop any storage used */
-  if (allocbufa!=NULL) free(allocbufa); /* .. */
-  if (allocbuft!=NULL) free(allocbuft); /* .. */
+  free(allocrhs);	/* drop any storage used */
+  free(allocbufa); /* .. */
+  free(allocbuft); /* .. */
   /* [status is handled by caller] */
   return res;
   } /* decExpOp */
@@ -5794,8 +5794,8 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs,
     decFinish(res, set, &residue, status);	 /* cleanup/set flags */
     } while(0); 			/* end protected */

-  if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */
-  if (allocbufb!=NULL) free(allocbufb); /* .. */
+  free(allocbufa); /* drop any storage used */
+  free(allocbufb); /* .. */
   /* [status is handled by caller] */
   return res;
   } /* decLnOp */
@@ -5959,8 +5959,8 @@ static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs,
     } while(0); 			/* end protected */

   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);	/* drop any storage used */
-  if (alloclhs!=NULL) free(alloclhs);	/* .. */
+  free(allocrhs);	/* drop any storage used */
+  free(alloclhs);	/* .. */
   #endif
   return res;
   } /* decQuantizeOp */
@@ -6142,8 +6142,8 @@ decNumber * decCompareOp(decNumber *res, const decNumber *lhs,
       }
     }
   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);	/* free any storage used */
-  if (alloclhs!=NULL) free(alloclhs);	/* .. */
+  free(allocrhs);	/* free any storage used */
+  free(alloclhs);	/* .. */
   #endif
   return res;
   } /* decCompareOp */
@@ -6277,7 +6277,7 @@ static Int decUnitCompare(const Unit *a, Int alength,
     result=(*u==0 ? 0 : +1);
     }
   /* clean up and return the result */
-  if (allocacc!=NULL) free(allocacc);	/* drop any storage used */
+  free(allocacc);	/* drop any storage used */
   return result;
   } /* decUnitCompare */

diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 33e2836..334369f 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,13 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* intrinsics/move_alloc.c (move_alloc): Remove useless
+	if-before-free test.
+	* io/fbuf.c (fbuf_destroy): Likewise.
+	* io/format.c (save_parsed_format): Likewise.
+	* io/open.c (already_open): Likewise.
+	* io/unit.c (free_internal_unit, close_unit_1): Likewise.
+	* io/unix.c (mem_close): Likewise.
+
 2011-03-04  Janne Blomqvist  <jb@gcc.gnu.org>

 	PR libfortran/47802
diff --git a/libgfortran/intrinsics/move_alloc.c b/libgfortran/intrinsics/move_alloc.c
index 9b5497c..f76c20c 100644
--- a/libgfortran/intrinsics/move_alloc.c
+++ b/libgfortran/intrinsics/move_alloc.c
@@ -37,8 +37,7 @@ move_alloc (gfc_array_char * from, gfc_array_char * to)
 {
   int i;

-  if (to->data)
-    free (to->data);
+  free (to->data);

   for (i = 0; i < GFC_DESCRIPTOR_RANK (from); i++)
     {
diff --git a/libgfortran/io/fbuf.c b/libgfortran/io/fbuf.c
index 82b3f6b..353e5ae 100644
--- a/libgfortran/io/fbuf.c
+++ b/libgfortran/io/fbuf.c
@@ -51,8 +51,7 @@ fbuf_destroy (gfc_unit * u)
 {
   if (u->fbuf == NULL)
     return;
-  if (u->fbuf->buf)
-    free (u->fbuf->buf);
+  free (u->fbuf->buf);
   free (u->fbuf);
   u->fbuf = NULL;
 }
diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c
index d540fc4..70f4f2d 100644
--- a/libgfortran/io/format.c
+++ b/libgfortran/io/format.c
@@ -149,8 +149,7 @@ save_parsed_format (st_parameter_dt *dtp)
     free_format_data (u->format_hash_table[hash].hashed_fmt);
   u->format_hash_table[hash].hashed_fmt = NULL;

-  if (u->format_hash_table[hash].key != NULL)
-    free (u->format_hash_table[hash].key);
+  free (u->format_hash_table[hash].key);
   u->format_hash_table[hash].key = get_mem (dtp->format_len);
   memcpy (u->format_hash_table[hash].key, dtp->format, dtp->format_len);

diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index d7448c0..f0abeeb 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -689,8 +689,7 @@ already_open (st_parameter_open *opp, gfc_unit * u, unit_flags * flags)
 	}

       u->s = NULL;
-      if (u->file)
-	free (u->file);
+      free (u->file);
       u->file = NULL;
       u->file_len = 0;

diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index 1d52217..e8a9b84 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -483,11 +483,9 @@ free_internal_unit (st_parameter_dt *dtp)

   if (dtp->u.p.current_unit != NULL)
     {
-      if (dtp->u.p.current_unit->ls != NULL)
-	free (dtp->u.p.current_unit->ls);
+      free (dtp->u.p.current_unit->ls);
   
-      if (dtp->u.p.current_unit->s)
-	free (dtp->u.p.current_unit->s);
+      free (dtp->u.p.current_unit->s);
   
       destroy_unit_mutex (dtp->u.p.current_unit);
     }
@@ -652,8 +650,7 @@ close_unit_1 (gfc_unit *u, int locked)

   delete_unit (u);

-  if (u->file)
-    free (u->file);
+  free (u->file);
   u->file = NULL;
   u->file_len = 0;

diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 12536ca..fd16fbe 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -849,8 +849,7 @@ mem_flush (unix_stream * s __attribute__ ((unused)))
 static int
 mem_close (unix_stream * s)
 {
-  if (s != NULL)
-    free (s);
+  free (s);

   return 0;
 }
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 802cf96..87f6be3 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,5 +1,18 @@
 2011-03-08  Jim Meyering  <meyering@redhat.com>

+	* cp-demint.c (cplus_demangle_v3_components): Remove useless
+	if-before-free.
+	* cplus-dem.c (squangle_mop_up): Likewise.
+	(delete_non_B_K_work_stuff): Likewise.
+	* pex-common.c (pex_free): Likewise.
+	* pex-msdos.c (pex_msdos_cleanup): Likewise.
+	* pex-win32.c (mingw_rootify, msys_rootify): Likewise.
+	(win32_spawn): Likewise.
+	* regex.c (FREE_VAR, weak_alias): Likewise.
+	* spaces.c (spaces): Likewise.
+
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
 	avoid memory overrun in a test leading to potential double-free
 	* testsuite/test-expandargv.c (writeout_test): Fix off-by-one error:
 	i.e., do copy the trailing NUL byte.
diff --git a/libiberty/cp-demint.c b/libiberty/cp-demint.c
index 2e8f8d2..1d1a77a 100644
--- a/libiberty/cp-demint.c
+++ b/libiberty/cp-demint.c
@@ -206,10 +206,8 @@ cplus_demangle_v3_components (const char *mangled, int options, void **mem)
 	     malloc (di.num_subs * sizeof (struct demangle_component *)));
   if (di.comps == NULL || di.subs == NULL)
     {
-      if (di.comps != NULL)
-	free (di.comps);
-      if (di.subs != NULL)
-	free (di.subs);
+      free (di.comps);
+      free (di.subs);
       return NULL;
     }

diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c
index 84f94b6..629d77b 100644
--- a/libiberty/cplus-dem.c
+++ b/libiberty/cplus-dem.c
@@ -1215,14 +1215,8 @@ squangle_mop_up (struct work_stuff *work)
 {
   /* clean up the B and K type mangling types. */
   forget_B_and_K_types (work);
-  if (work -> btypevec != NULL)
-    {
-      free ((char *) work -> btypevec);
-    }
-  if (work -> ktypevec != NULL)
-    {
-      free ((char *) work -> ktypevec);
-    }
+  free ((char *) work -> btypevec);
+  free ((char *) work -> ktypevec);
 }


@@ -1311,8 +1305,7 @@ delete_non_B_K_work_stuff (struct work_stuff *work)
       int i;

       for (i = 0; i < work->ntmpl_args; i++)
-	if (work->tmpl_argvec[i])
-	  free ((char*) work->tmpl_argvec[i]);
+	free ((char*) work->tmpl_argvec[i]);

       free ((char*) work->tmpl_argvec);
       work->tmpl_argvec = NULL;
diff --git a/libiberty/pex-common.c b/libiberty/pex-common.c
index 55b63ae..6fd3fde 100644
--- a/libiberty/pex-common.c
+++ b/libiberty/pex-common.c
@@ -623,12 +623,9 @@ pex_free (struct pex_obj *obj)

   if (obj->next_input_name_allocated)
     free (obj->next_input_name);
-  if (obj->children != NULL)
-    free (obj->children);
-  if (obj->status != NULL)
-    free (obj->status);
-  if (obj->time != NULL)
-    free (obj->time);
+  free (obj->children);
+  free (obj->status);
+  free (obj->time);

   if (obj->remove_count > 0)
     {
diff --git a/libiberty/pex-msdos.c b/libiberty/pex-msdos.c
index 4b77bf6..fa0f40a 100644
--- a/libiberty/pex-msdos.c
+++ b/libiberty/pex-msdos.c
@@ -310,10 +310,8 @@ pex_msdos_cleanup (struct pex_obj  *obj)

   ms = (struct pex_msdos *) obj->sysdep;
   for (i = 0; i < PEX_MSDOS_FILE_COUNT; ++i)
-    if (msdos->files[i] != NULL)
-      free (msdos->files[i]);
-  if (msdos->statuses != NULL)
-    free (msdos->statuses);
+    free (msdos->files[i]);
+  free (msdos->statuses);
   free (msdos);
   obj->sysdep = NULL;
 }
diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c
index 4427406..107ac6f 100644
--- a/libiberty/pex-win32.c
+++ b/libiberty/pex-win32.c
@@ -210,10 +210,8 @@ mingw_rootify (const char *executable)
   if (!namebuf || !foundbuf)
     {
       RegCloseKey (hKey);
-      if (namebuf)
-	free (namebuf);
-      if (foundbuf)
-	free (foundbuf);
+      free (namebuf);
+      free (foundbuf);
       return executable;
     }

@@ -315,8 +313,7 @@ msys_rootify (const char *executable)
     return tack_on_executable (buf, executable);

   /* failed */
-  if (buf)
-    free (buf);
+  free (buf);
   return executable;
 }
 #endif
@@ -607,8 +604,7 @@ win32_spawn (const char *executable,
 		      si,
 		      pi))
     {
-      if (env_block)
-        free (env_block);
+      free (env_block);

       free (full_executable);

@@ -618,18 +614,14 @@ win32_spawn (const char *executable,
   /* Clean up.  */
   CloseHandle (pi->hThread);
   free (full_executable);
-  if (env_block)
-    free (env_block);
+  free (env_block);

   return (pid_t) pi->hProcess;

  error:
-  if (env_block)
-    free (env_block);
-  if (cmdline)
-    free (cmdline);
-  if (full_executable)
-    free (full_executable);
+  free (env_block);
+  free (cmdline);
+  free (full_executable);

   return (pid_t) -1;
 }
diff --git a/libiberty/regex.c b/libiberty/regex.c
index 420c7f4..d65eedb 100644
--- a/libiberty/regex.c
+++ b/libiberty/regex.c
@@ -4970,7 +4970,7 @@ weak_alias (__re_search_2, re_search_2)
 #ifdef MATCH_MAY_ALLOCATE
 # define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL
 #else
-# define FREE_VAR(var) if (var) free (var); var = NULL
+# define FREE_VAR(var) free (var); var = NULL
 #endif

 #ifdef WCHAR
@@ -8111,20 +8111,17 @@ weak_alias (__regerror, regerror)
 void
 regfree (regex_t *preg)
 {
-  if (preg->buffer != NULL)
-    free (preg->buffer);
+  free (preg->buffer);
   preg->buffer = NULL;

   preg->allocated = 0;
   preg->used = 0;

-  if (preg->fastmap != NULL)
-    free (preg->fastmap);
+  free (preg->fastmap);
   preg->fastmap = NULL;
   preg->fastmap_accurate = 0;

-  if (preg->translate != NULL)
-    free (preg->translate);
+  free (preg->translate);
   preg->translate = NULL;
 }
 #ifdef _LIBC
diff --git a/libiberty/spaces.c b/libiberty/spaces.c
index 67481c9..69d7a2d 100644
--- a/libiberty/spaces.c
+++ b/libiberty/spaces.c
@@ -53,10 +53,7 @@ spaces (int count)

   if (count > maxsize)
     {
-      if (buf)
-	{
-	  free (buf);
-	}
+      free (buf);
       buf = (char *) malloc (count + 1);
       if (buf == (char *) 0)
 	return 0;
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 44c87be..e77ea9f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* libsupc++/del_opnt.cc (operator delete): Remove useless
+	if-before-free.
+
 2011-03-07  Jason Merrill  <jason@redhat.com>

 	* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Adjust
diff --git a/libstdc++-v3/libsupc++/del_opnt.cc b/libstdc++-v3/libsupc++/del_opnt.cc
index 75051d5..29eab10 100644
--- a/libstdc++-v3/libsupc++/del_opnt.cc
+++ b/libstdc++-v3/libsupc++/del_opnt.cc
@@ -31,6 +31,5 @@ extern "C" void free (void *);
 _GLIBCXX_WEAK_DEFINITION void
 operator delete (void *ptr, const std::nothrow_t&) throw ()
 {
-  if (ptr)
-    free (ptr);
+  free (ptr);
 }
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog
index e4a19cd..d5cac0b 100644
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-08  Jim Meyering  <meyering@redhat.com>
+
+	* lto-plugin.c (free_1, free_2): Remove useless if-before-free.
+
 2011-02-13  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

 	* Makefile.in: Regenerate.
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index 64a0164..6f8a387 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -312,8 +312,7 @@ free_1 (void)
 	{
 	  struct ld_plugin_symbol *s = &symtab->syms[j];
 	  free (s->name);
-	  if (s->comdat_key)
-	    free (s->comdat_key);
+	  free (s->comdat_key);
 	}
       free (symtab->syms);
       symtab->syms = NULL;
@@ -342,8 +341,7 @@ free_2 (void)
   claimed_files = NULL;
   num_claimed_files = 0;

-  if (arguments_file_name)
-    free (arguments_file_name);
+  free (arguments_file_name);
   arguments_file_name = NULL;
 }

-- 
1.7.4.1.299.ga459d

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2] Re: avoid useless if-before-free tests
  2011-03-08 17:03       ` Jim Meyering
@ 2011-03-08 18:45         ` Rainer Orth
  2011-03-08 19:13           ` Jim Meyering
  0 siblings, 1 reply; 31+ messages in thread
From: Rainer Orth @ 2011-03-08 18:45 UTC (permalink / raw)
  To: Jim Meyering; +Cc: Joseph S. Myers, gcc-patches, java-patches, Ian Lance Taylor

Jim Meyering <jim@meyering.net> writes:

>> the change at hand.  And please don't change the alignment of entries
>> with multiple email addresses.
>
> Changing 8-spaces to a TAB does not affect alignment when you're
> looking at the ChangeLog file itself with standard tab setting.
>
> Perhaps you looked at a hunk like the following and mistook it
> for one that introduces an alignment change?
>
>  2011-11-04  Eric Botcazou  <ebotcazou@adacore.com>
> -            Jakub Jelinek  <jakub@redhat.com>
> +	   Jakub Jelinek  <jakub@redhat.com>
>
> It does not.

I'm pretty sure it does: before, you have 12 SPC, afterwards you have
TAB + 3 SPC, which is equivalent to 11 SPC in my book.

I honestly don't see the point of this whitespace change unless done
across all ChangeLogs, not just a few that you happen to touch.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2] Re: avoid useless if-before-free tests
  2011-03-08 18:45         ` Rainer Orth
@ 2011-03-08 19:13           ` Jim Meyering
  2011-03-08 19:20             ` Rainer Orth
  0 siblings, 1 reply; 31+ messages in thread
From: Jim Meyering @ 2011-03-08 19:13 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Joseph S. Myers, gcc-patches, java-patches, Ian Lance Taylor

Rainer Orth wrote:
> Jim Meyering <jim@meyering.net> writes:
>>> the change at hand.  And please don't change the alignment of entries
>>> with multiple email addresses.
>>
>> Changing 8-spaces to a TAB does not affect alignment when you're
>> looking at the ChangeLog file itself with standard tab setting.
>>
>> Perhaps you looked at a hunk like the following and mistook it
>> for one that introduces an alignment change?
>>
>>  2011-11-04  Eric Botcazou  <ebotcazou@adacore.com>
>> -            Jakub Jelinek  <jakub@redhat.com>
>> +	   Jakub Jelinek  <jakub@redhat.com>
>>
>> It does not.
>
> I'm pretty sure it does: before, you have 12 SPC, afterwards you have
> TAB + 3 SPC, which is equivalent to 11 SPC in my book.

Here's the precise excerpt from my patch:

 2011-11-04  Eric Botcazou  <ebotcazou@adacore.com>
-            Jakub Jelinek  <jakub@redhat.com>
+	    Jakub Jelinek  <jakub@redhat.com>

That has TAB + 4, so induced no alignment change.

> I honestly don't see the point of this whitespace change unless done
> across all ChangeLogs, not just a few that you happen to touch.

As I said, it's gone, now, from my patch.
If no one objects, I'll normalize all ChangeLog files.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2] Re: avoid useless if-before-free tests
  2011-03-08 19:13           ` Jim Meyering
@ 2011-03-08 19:20             ` Rainer Orth
  2011-03-08 19:39               ` Jakub Jelinek
  0 siblings, 1 reply; 31+ messages in thread
From: Rainer Orth @ 2011-03-08 19:20 UTC (permalink / raw)
  To: Jim Meyering; +Cc: Joseph S. Myers, gcc-patches, java-patches, Ian Lance Taylor

Jim Meyering <jim@meyering.net> writes:

>> I honestly don't see the point of this whitespace change unless done
>> across all ChangeLogs, not just a few that you happen to touch.
>
> As I said, it's gone, now, from my patch.
> If no one objects, I'll normalize all ChangeLog files.

No objection per se, although it's for the RMs to decide about the
timing.  If you do, it would be good to fix other issues flagged by
Emacs's Change Log mode, like trailing whitespace.

Thanks.
	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v3] Re: avoid useless if-before-free tests
  2011-03-08 17:54     ` [PATCH v3] " Jim Meyering
@ 2011-03-08 19:34       ` DJ Delorie
  2011-03-15  9:19       ` Janne Blomqvist
  1 sibling, 0 replies; 31+ messages in thread
From: DJ Delorie @ 2011-03-08 19:34 UTC (permalink / raw)
  To: Jim Meyering; +Cc: joseph, gcc-patches, java-patches, fortran


I'm OK with the libiberty parts.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2] Re: avoid useless if-before-free tests
  2011-03-08 19:20             ` Rainer Orth
@ 2011-03-08 19:39               ` Jakub Jelinek
  0 siblings, 0 replies; 31+ messages in thread
From: Jakub Jelinek @ 2011-03-08 19:39 UTC (permalink / raw)
  To: Rainer Orth
  Cc: Jim Meyering, Joseph S. Myers, gcc-patches, java-patches,
	Ian Lance Taylor

On Tue, Mar 08, 2011 at 08:20:22PM +0100, Rainer Orth wrote:
> Jim Meyering <jim@meyering.net> writes:
> 
> >> I honestly don't see the point of this whitespace change unless done
> >> across all ChangeLogs, not just a few that you happen to touch.
> >
> > As I said, it's gone, now, from my patch.
> > If no one objects, I'll normalize all ChangeLog files.
> 
> No objection per se, although it's for the RMs to decide about the
> timing.

The good timing for the if (x) free (x); patch is right after stage 1
reopens, which will be hopefully RSN.

	Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v3] Re: avoid useless if-before-free tests
  2011-03-08 17:54     ` [PATCH v3] " Jim Meyering
  2011-03-08 19:34       ` DJ Delorie
@ 2011-03-15  9:19       ` Janne Blomqvist
  2011-03-15 10:03         ` [PATCH gcc/fortran] get rid of gfc_free Jim Meyering
  2011-03-24 16:51         ` [PATCH v3] Re: avoid useless if-before-free tests Jim Meyering
  1 sibling, 2 replies; 31+ messages in thread
From: Janne Blomqvist @ 2011-03-15  9:19 UTC (permalink / raw)
  To: Jim Meyering; +Cc: Joseph S. Myers, gcc-patches, java-patches, fortran

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.

> From 0d18b70a8821ab2fc58b5ed592ed611e05a29c7f Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering@redhat.com>
> Date: Mon, 3 Jan 2011 16:52:37 +0100
> Subject: [PATCH 1/2] discourage unnecessary use of if before free
>
> * README.Portability: Explain why "if (P) free (P)" is best avoided.
> ---
>  gcc/README.Portability |   23 ++++++++++++++++-------
>  1 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/gcc/README.Portability b/gcc/README.Portability
> index 32a33e2..e099a3f 100644
> --- a/gcc/README.Portability
> +++ b/gcc/README.Portability
> @@ -51,14 +51,24 @@ foo (bar, )
>  needs to be coded in some other way.
>
>
> -free and realloc
> -----------------
> +Avoid unnecessary test before free
> +----------------------------------
>
> -Some implementations crash upon attempts to free or realloc the null
> -pointer.  Thus if mem might be null, you need to write
> +Since SunOS 4 stopped being a reasonable portability target,
> +(which happened around 2007) there has been no need to guard
> +against "free (NULL)".  Thus, any guard like the following
> +constitutes a redundant test:
>
> -  if (mem)
> -    free (mem);
> +  if (P)
> +    free (P);
> +
> +It is better to avoid the test.[*]
> +Instead, simply free P, regardless of whether it is NULL.
> +
> +[*] However, if your profiling exposes a test like this in a
> +performance-critical loop, say where P is nearly always NULL, and
> +the cost of calling free on a NULL pointer would be prohibitively
> +high, please let us know.

Instead of "please let us know", maybe recommend using
__builtin_expect instead? E.g. something like

if (__builtin_expect (ptr != NULL, 0))
    free (ptr);


-- 
Janne Blomqvist

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH gcc/fortran] get rid of gfc_free
  2011-03-15  9:19       ` Janne Blomqvist
@ 2011-03-15 10:03         ` Jim Meyering
  2011-03-15 10:08           ` Jakub Jelinek
  2011-03-15 14:18           ` Janne Blomqvist
  2011-03-24 16:51         ` [PATCH v3] Re: avoid useless if-before-free tests Jim Meyering
  1 sibling, 2 replies; 31+ messages in thread
From: Jim Meyering @ 2011-03-15 10:03 UTC (permalink / raw)
  To: Janne Blomqvist; +Cc: Joseph S. Myers, gcc-patches, java-patches, fortran

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.

Hi Janne,

These requested changes are in addition to (and independent of)
the changes that I've already posted here.  The first cset below
does your #2 and #3, and the second does #1.  I separate them for
review because #1 is completely mechanical, while the others
are manual.  You may prefer to combine them before pushing, for
bisection.  Let me know if you'd prefer I submit in that form.

...
>> +It is better to avoid the test.[*]
>> +Instead, simply free P, regardless of whether it is NULL.
>> +
>> +[*] However, if your profiling exposes a test like this in a
>> +performance-critical loop, say where P is nearly always NULL, and
>> +the cost of calling free on a NULL pointer would be prohibitively
>> +high, please let us know.
>
> Instead of "please let us know", maybe recommend using
> __builtin_expect instead? E.g. something like
>
> if (__builtin_expect (ptr != NULL, 0))
>     free (ptr);

Good idea.  Thanks.
Though how about avoiding the double negative?

   if (__builtin_expect (ptr == NULL, 1))
     free (ptr);

I've squashed the following onto my just-rebased commit:

diff --git a/gcc/README.Portability b/gcc/README.Portability
index e099a3f..4101a2f 100644
--- a/gcc/README.Portability
+++ b/gcc/README.Portability
@@ -68,7 +68,11 @@ Instead, simply free P, regardless of whether it is NULL.
 [*] However, if your profiling exposes a test like this in a
 performance-critical loop, say where P is nearly always NULL, and
 the cost of calling free on a NULL pointer would be prohibitively
-high, please let us know.
+high, consider using __builtin_expect, e.g., like this:
+
+  if (__builtin_expect (ptr == NULL, 1))
+    free (ptr);
+


 Trigraphs
-----------------------------------------------------


From c198b77add6d587cbe87f2d86049c46196946398 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Tue, 15 Mar 2011 10:33:03 +0100
Subject: [PATCH 1/2] gfortran: remove definition and prototype of gfc_free

* misc.c (gfc_free): Remove function.
* gfortran.h (gfc_free): Remove its prototype.
(free): Remove macro definition that would otherwise prevent
direct use of the function.
---
 gcc/fortran/ChangeLog  |    7 +++++++
 gcc/fortran/gfortran.h |    2 --
 gcc/fortran/misc.c     |    9 ---------
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 1871c71..bc2e1b2 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2011-03-15  Jim Meyering  <meyering@redhat.com>
+
+	* misc.c (gfc_free): Remove function.
+	* gfortran.h (gfc_free): Remove its prototype.
+	(free): Remove macro definition that would otherwise prevent
+	direct use of the function.
+
 2011-03-08  Jim Meyering  <meyering@redhat.com>

 	* gfortranspec.c (lang_specific_pre_link): Remove useless
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index b64fa20..24d1941 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -49,7 +49,6 @@ along with GCC; see the file COPYING3.  If not see
 #define MAX_SUBRECORD_LENGTH 2147483639   /* 2**31-9 */


-#define free(x) Use_gfc_free_instead_of_free()
 #define gfc_is_whitespace(c) ((c==' ') || (c=='\t'))

 /* Stringization.  */
@@ -2366,7 +2365,6 @@ void gfc_end_source_files (void);

 /* misc.c */
 void *gfc_getmem (size_t) ATTRIBUTE_MALLOC;
-void gfc_free (void *);
 int gfc_terminal_width (void);
 void gfc_clear_ts (gfc_typespec *);
 FILE *gfc_open_file (const char *);
diff --git a/gcc/fortran/misc.c b/gcc/fortran/misc.c
index 8a343a0..9d7d121 100644
--- a/gcc/fortran/misc.c
+++ b/gcc/fortran/misc.c
@@ -42,15 +42,6 @@ gfc_getmem (size_t n)
 }


-void
-gfc_free (void *p)
-{
-  /* The parentheses around free are needed in order to call not
-     the redefined free of gfortran.h.  */
-  (free) (p);
-}
-
-
 /* Get terminal width.  */

 int
--
1.7.4.1.408.gb6b16


From 51ec56ecddf38589511502c58d75e1680e5a17e2 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Tue, 15 Mar 2011 10:37:17 +0100
Subject: [PATCH 2/2] convert each use of gfc_free (p) to free (p)

Do that by running this command:
  perl -pi -e    's/\bgfc_free ?\(/free (/' \
    $(git grep -El '\bgfc_free ?\(')
which also corrects the few uses that lacked a space between the
function name and the open parenthesis.
---
 gcc/fortran/ChangeLog         |    7 +++++
 gcc/fortran/array.c           |    4 +-
 gcc/fortran/constructor.c     |    2 +-
 gcc/fortran/cpp.c             |    8 +++---
 gcc/fortran/data.c            |    2 +-
 gcc/fortran/decl.c            |   22 +++++++++---------
 gcc/fortran/dependency.c      |    2 +-
 gcc/fortran/error.c           |    4 +-
 gcc/fortran/expr.c            |   24 +++++++++---------
 gcc/fortran/frontend-passes.c |   14 +++++-----
 gcc/fortran/interface.c       |   16 ++++++------
 gcc/fortran/intrinsic.c       |   10 ++++----
 gcc/fortran/io.c              |   16 ++++++------
 gcc/fortran/match.c           |   14 +++++-----
 gcc/fortran/module.c          |   50 ++++++++++++++++++++--------------------
 gcc/fortran/openmp.c          |    2 +-
 gcc/fortran/options.c         |    2 +-
 gcc/fortran/parse.c           |    4 +-
 gcc/fortran/primary.c         |    4 +-
 gcc/fortran/resolve.c         |    8 +++---
 gcc/fortran/scanner.c         |   46 ++++++++++++++++++------------------
 gcc/fortran/simplify.c        |   16 ++++++------
 gcc/fortran/st.c              |    6 ++--
 gcc/fortran/symbol.c          |   42 +++++++++++++++++-----------------
 gcc/fortran/trans-array.c     |   26 ++++++++++----------
 gcc/fortran/trans-common.c    |    6 ++--
 gcc/fortran/trans-const.c     |    4 +-
 gcc/fortran/trans-decl.c      |    2 +-
 gcc/fortran/trans-expr.c      |   16 ++++++------
 gcc/fortran/trans-intrinsic.c |    2 +-
 gcc/fortran/trans-io.c        |    8 +++---
 gcc/fortran/trans-openmp.c    |    8 +++---
 gcc/fortran/trans-stmt.c      |   20 ++++++++--------
 gcc/fortran/trans.c           |    6 ++--
 34 files changed, 215 insertions(+), 208 deletions(-)

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index bc2e1b2..18f2ed8 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,12 @@
 2011-03-15  Jim Meyering  <meyering@redhat.com>

+	convert each use of gfc_free (p) to free (p)
+	Do that by running this command:
+	  perl -pi -e    's/\bgfc_free ?\(/free (/' \
+	    $(git grep -El '\bgfc_free ?\(')
+	which also corrects the few uses that lacked a space between the
+	function name and the open parenthesis.
+
 	* misc.c (gfc_free): Remove function.
 	* gfortran.h (gfc_free): Remove its prototype.
 	(free): Remove macro definition that would otherwise prevent
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index ff0977a..c350ef5 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -283,7 +283,7 @@ gfc_free_array_spec (gfc_array_spec *as)
       gfc_free_expr (as->upper[i]);
     }

-  gfc_free (as);
+  free (as);
 }


@@ -751,7 +751,7 @@ gfc_set_array_spec (gfc_symbol *sym, gfc_array_spec *as, locus *error_loc)
 	}
     }

-  gfc_free (as);
+  free (as);
   return SUCCESS;
 }

diff --git a/gcc/fortran/constructor.c b/gcc/fortran/constructor.c
index 45228b0..9739981 100644
--- a/gcc/fortran/constructor.c
+++ b/gcc/fortran/constructor.c
@@ -37,7 +37,7 @@ node_free (splay_tree_value value)

   mpz_clear (c->offset);

-  gfc_free (c);
+  free (c);
 }


diff --git a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c
index 4c1307c..0dece6c 100644
--- a/gcc/fortran/cpp.c
+++ b/gcc/fortran/cpp.c
@@ -1109,8 +1109,8 @@ dump_queued_macros (cpp_reader *pfile ATTRIBUTE_UNUSED)
       print.src_line++;
       oq = q;
       q = q->next;
-      gfc_free (oq->macro);
-      gfc_free (oq);
+      free (oq->macro);
+      free (oq);
     }
   cpp_define_queue = NULL;
   for (q = cpp_undefine_queue; q;)
@@ -1120,8 +1120,8 @@ dump_queued_macros (cpp_reader *pfile ATTRIBUTE_UNUSED)
       print.src_line++;
       oq = q;
       q = q->next;
-      gfc_free (oq->macro);
-      gfc_free (oq);
+      free (oq->macro);
+      free (oq);
     }
   cpp_undefine_queue = NULL;
 }
diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c
index b1cfd6e..137a939 100644
--- a/gcc/fortran/data.c
+++ b/gcc/fortran/data.c
@@ -235,7 +235,7 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index)
 	    {
 	      gcc_assert (ref->u.ar.as->corank > 0);
 	      if (init == NULL)
-		gfc_free (expr);
+		free (expr);
 	      continue;
 	    }

diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 8b5f92b..2f8357d 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -119,7 +119,7 @@ free_variable (gfc_data_variable *p)
       gfc_free_expr (p->expr);
       gfc_free_iterator (&p->iter, 0);
       free_variable (p->list);
-      gfc_free (p);
+      free (p);
     }
 }

@@ -136,7 +136,7 @@ free_value (gfc_data_value *p)
       q = p->next;
       mpz_clear (p->repeat);
       gfc_free_expr (p->expr);
-      gfc_free (p);
+      free (p);
     }
 }

@@ -153,7 +153,7 @@ gfc_free_data (gfc_data *p)
       q = p->next;
       free_variable (p->var);
       free_value (p->value);
-      gfc_free (p);
+      free (p);
     }
 }

@@ -168,7 +168,7 @@ gfc_free_data_all (gfc_namespace *ns)
   for (;ns->data;)
     {
       d = ns->data->next;
-      gfc_free (ns->data);
+      free (ns->data);
       ns->data = d;
     }
 }
@@ -491,14 +491,14 @@ match_old_style_init (const char *name)
   m = top_val_list (newdata);
   if (m != MATCH_YES)
     {
-      gfc_free (newdata);
+      free (newdata);
       return m;
     }

   if (gfc_pure (NULL))
     {
       gfc_error ("Initialization at %C is not allowed in a PURE procedure");
-      gfc_free (newdata);
+      free (newdata);
       return MATCH_ERROR;
     }

@@ -508,7 +508,7 @@ match_old_style_init (const char *name)
   /* Mark the variable as having appeared in a data statement.  */
   if (gfc_add_data (&sym->attr, sym->name, &sym->declared_at) == FAILURE)
     {
-      gfc_free (newdata);
+      free (newdata);
       return MATCH_ERROR;
     }

@@ -1220,7 +1220,7 @@ gfc_set_constant_character_len (int len, gfc_expr *expr, int check_len)
 			&expr->where, slen, check_len);

       s[len] = '\0';
-      gfc_free (expr->value.character.string);
+      free (expr->value.character.string);
       expr->value.character.string = s;
       expr->value.character.length = len;
     }
@@ -1275,7 +1275,7 @@ gfc_free_enum_history (void)
   while (current != NULL)
     {
       next = current->next;
-      gfc_free (current);
+      free (current);
       current = next;
     }
   max_enum = NULL;
@@ -3335,7 +3335,7 @@ match_attr_spec (void)
 	  else if (m == MATCH_YES)
 	    {
 	      merge_array_spec (as, current_as, false);
-	      gfc_free (as);
+	      free (as);
 	    }

 	  if (m == MATCH_NO)
@@ -7078,7 +7078,7 @@ syntax:
   while (interface != old_interface_head)
   {
     gfc_interface *i = interface->next;
-    gfc_free (interface);
+    free (interface);
     interface = i;
   }

diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index 77e8df7..fbb893c 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -1145,7 +1145,7 @@ check_section_vs_section (gfc_array_ref *l_ar, gfc_array_ref *r_ar, int n)
   else
     start_comparison = -2;
       
-  gfc_free (one_expr);
+  free (one_expr);

   /* Determine LHS upper and lower bounds.  */
   if (l_dir == 1)
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index bedb629..aee9173 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -1050,7 +1050,7 @@ gfc_pop_error (gfc_error_buf *err)
       size_t len = strlen (err->message) + 1;
       gcc_assert (len <= error_buffer.allocated);
       memcpy (error_buffer.message, err->message, len);
-      gfc_free (err->message);
+      free (err->message);
     }
 }

@@ -1061,7 +1061,7 @@ void
 gfc_free_error (gfc_error_buf *err)
 {
   if (err->flag)
-    gfc_free (err->message);
+    free (err->message);
 }


diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 58b6036..5124fce 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -421,7 +421,7 @@ free_expr0 (gfc_expr *e)
 	  break;

 	case BT_CHARACTER:
-	  gfc_free (e->value.character.string);
+	  free (e->value.character.string);
 	  break;

 	case BT_COMPLEX:
@@ -434,7 +434,7 @@ free_expr0 (gfc_expr *e)

       /* Free the representation.  */
       if (e->representation.string)
-	gfc_free (e->representation.string);
+	free (e->representation.string);

       break;

@@ -463,7 +463,7 @@ free_expr0 (gfc_expr *e)
       break;

     case EXPR_SUBSTRING:
-      gfc_free (e->value.character.string);
+      free (e->value.character.string);
       break;

     case EXPR_NULL:
@@ -479,7 +479,7 @@ free_expr0 (gfc_expr *e)
       for (n = 0; n < e->rank; n++)
 	mpz_clear (e->shape[n]);

-      gfc_free (e->shape);
+      free (e->shape);
     }

   gfc_free_ref_list (e->ref);
@@ -496,7 +496,7 @@ gfc_free_expr (gfc_expr *e)
   if (e == NULL)
     return;
   free_expr0 (e);
-  gfc_free (e);
+  free (e);
 }


@@ -511,7 +511,7 @@ gfc_free_actual_arglist (gfc_actual_arglist *a1)
     {
       a2 = a1->next;
       gfc_free_expr (a1->expr);
-      gfc_free (a1);
+      free (a1);
       a1 = a2;
     }
 }
@@ -579,7 +579,7 @@ gfc_free_ref_list (gfc_ref *p)
 	  break;
 	}

-      gfc_free (p);
+      free (p);
     }
 }

@@ -591,7 +591,7 @@ gfc_replace_expr (gfc_expr *dest, gfc_expr *src)
 {
   free_expr0 (dest);
   *dest = *src;
-  gfc_free (src);
+  free (src);
 }


@@ -640,7 +640,7 @@ gfc_copy_ref (gfc_ref *src)
     case REF_ARRAY:
       ar = gfc_copy_array_ref (&src->u.ar);
       dest->u.ar = *ar;
-      gfc_free (ar);
+      free (ar);
       break;

     case REF_COMPONENT:
@@ -1566,7 +1566,7 @@ find_substring_ref (gfc_expr *p, gfc_expr **newp)
     return FAILURE;

   *newp = gfc_copy_expr (p);
-  gfc_free ((*newp)->value.character.string);
+  free ((*newp)->value.character.string);

   end = (int) mpz_get_ui (p->ref->u.ss.end->value.integer);
   start = (int) mpz_get_ui (p->ref->u.ss.start->value.integer);
@@ -1840,7 +1840,7 @@ gfc_simplify_expr (gfc_expr *p, int type)
 	  memcpy (s, p->value.character.string + start,
 		  (end - start) * sizeof (gfc_char_t));
 	  s[end - start + 1] = '\0';  /* TODO: C-style string.  */
-	  gfc_free (p->value.character.string);
+	  free (p->value.character.string);
 	  p->value.character.string = s;
 	  p->value.character.length = end - start;
 	  p->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
@@ -3594,7 +3594,7 @@ gfc_check_assign_symbol (gfc_symbol *sym, gfc_expr *rvalue)
   else
     r = gfc_check_assign (&lvalue, rvalue, 1);

-  gfc_free (lvalue.symtree);
+  free (lvalue.symtree);

   if (r == FAILURE)
     return r;
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index 7c55767..c3541f2 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -245,7 +245,7 @@ strip_function_call (gfc_expr *e)

   /* Graft the argument expression onto the original function.  */
   *e = *e1;
-  gfc_free (e1);
+  free (e1);

 }

@@ -356,8 +356,8 @@ optimize_comparison (gfc_expr *e, gfc_intrinsic_op op)
 		    return -2;
 		  else
 		    {
-		      gfc_free (op1_left);
-		      gfc_free (op2_left);
+		      free (op1_left);
+		      free (op2_left);
 		      e->value.op.op1 = op1_right;
 		      e->value.op.op2 = op2_right;
 		      optimize_comparison (e, op);
@@ -366,8 +366,8 @@ optimize_comparison (gfc_expr *e, gfc_intrinsic_op op)
 		}
 	      if (gfc_dep_compare_expr (op1_right, op2_right) == 0)
 		{
-		  gfc_free (op1_right);
-		  gfc_free (op2_right);
+		  free (op1_right);
+		  free (op2_right);
 		  e->value.op.op1 = op1_left;
 		  e->value.op.op2 = op2_left;
 		  optimize_comparison (e, op);
@@ -417,8 +417,8 @@ optimize_comparison (gfc_expr *e, gfc_intrinsic_op op)

 	  /* Replace the expression by a constant expression.  The typespec
 	     and where remains the way it is.  */
-	  gfc_free (op1);
-	  gfc_free (op2);
+	  free (op1);
+	  free (op2);
 	  e->expr_type = EXPR_CONSTANT;
 	  e->value.logical = result;
 	  return true;
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index b0b74c1..5dc0163 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -87,7 +87,7 @@ gfc_free_interface (gfc_interface *intr)
   for (; intr; intr = next)
     {
       next = intr->next;
-      gfc_free (intr);
+      free (intr);
     }
 }

@@ -912,7 +912,7 @@ count_types_test (gfc_formal_arglist *f1, gfc_formal_arglist *f2)
       k++;
     }

-  gfc_free (arg);
+  free (arg);

   return rc;
 }
@@ -1147,7 +1147,7 @@ check_interface0 (gfc_interface *p, const char *interface_name)
 	    {
 	      /* Duplicate interface.  */
 	      qlast->next = q->next;
-	      gfc_free (q);
+	      free (q);
 	      q = qlast->next;
 	    }
 	}
@@ -3150,8 +3150,8 @@ gfc_extend_expr (gfc_expr *e, bool *real_error)

       /* Don't use gfc_free_actual_arglist().  */
       if (actual->next != NULL)
-	gfc_free (actual->next);
-      gfc_free (actual);
+	free (actual->next);
+      free (actual);

       return FAILURE;
     }
@@ -3242,8 +3242,8 @@ gfc_extend_assign (gfc_code *c, gfc_namespace *ns)
 	  return SUCCESS;
 	}

-      gfc_free (actual->next);
-      gfc_free (actual);
+      free (actual->next);
+      free (actual);
       return FAILURE;
     }

@@ -3444,6 +3444,6 @@ gfc_free_formal_arglist (gfc_formal_arglist *p)
   for (; p; p = q)
     {
       q = p->next;
-      gfc_free (p);
+      free (p);
     }
 }
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index 80dbaa8..366d880 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -3407,9 +3407,9 @@ gfc_intrinsic_init_1 (void)
 void
 gfc_intrinsic_done_1 (void)
 {
-  gfc_free (functions);
-  gfc_free (conversion);
-  gfc_free (char_conversions);
+  free (functions);
+  free (conversion);
+  free (char_conversions);
   gfc_free_namespace (gfc_intrinsic_namespace);
 }

@@ -4367,7 +4367,7 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag)

   *expr = *new_expr;

-  gfc_free (new_expr);
+  free (new_expr);
   expr->ts = *ts;

   if (gfc_is_constant_expr (expr->value.function.actual->expr)
@@ -4436,7 +4436,7 @@ gfc_convert_chartype (gfc_expr *expr, gfc_typespec *ts)

   *expr = *new_expr;

-  gfc_free (new_expr);
+  free (new_expr);
   expr->ts = *ts;

   if (gfc_is_constant_expr (expr->value.function.actual->expr)
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index 3ce7e81..df9ee1e 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -1640,7 +1640,7 @@ gfc_free_open (gfc_open *open)
   gfc_free_expr (open->convert);
   gfc_free_expr (open->asynchronous);
   gfc_free_expr (open->newunit);
-  gfc_free (open);
+  free (open);
 }


@@ -1764,7 +1764,7 @@ compare_to_allowed_values (const char *specifier, const char *allowed[],
       char *s = gfc_widechar_to_char (value, -1);
       gfc_warning ("%s specifier in %s statement at %C has invalid value '%s'",
 		   specifier, statement, s);
-      gfc_free (s);
+      free (s);
       return 1;
     }
   else
@@ -1772,7 +1772,7 @@ compare_to_allowed_values (const char *specifier, const char *allowed[],
       char *s = gfc_widechar_to_char (value, -1);
       gfc_error ("%s specifier in %s statement at %C has invalid value '%s'",
 		 specifier, statement, s);
-      gfc_free (s);
+      free (s);
       return 0;
     }
 }
@@ -2085,7 +2085,7 @@ gfc_match_open (void)
 					  -1);
 	  warn_or_error ("The STATUS specified in OPEN statement at %C is "
 			 "'%s' and no FILE specifier is present", s);
-	  gfc_free (s);
+	  free (s);
 	}

       /* F2003, 9.4.5: If the STATUS= specifier has the value SCRATCH,
@@ -2162,7 +2162,7 @@ gfc_free_close (gfc_close *close)
   gfc_free_expr (close->iomsg);
   gfc_free_expr (close->iostat);
   gfc_free_expr (close->status);
-  gfc_free (close);
+  free (close);
 }


@@ -2306,7 +2306,7 @@ gfc_free_filepos (gfc_filepos *fp)
   gfc_free_expr (fp->unit);
   gfc_free_expr (fp->iomsg);
   gfc_free_expr (fp->iostat);
-  gfc_free (fp);
+  free (fp);
 }


@@ -2740,7 +2740,7 @@ gfc_free_dt (gfc_dt *dt)
   gfc_free_expr (dt->pos);
   gfc_free_expr (dt->dt_io_kind);
   /* dt->extra_comma is a link to dt_io_kind if it is set.  */
-  gfc_free (dt);
+  free (dt);
 }


@@ -3822,7 +3822,7 @@ gfc_free_inquire (gfc_inquire *inquire)
   gfc_free_expr (inquire->sign);
   gfc_free_expr (inquire->size);
   gfc_free_expr (inquire->round);
-  gfc_free (inquire);
+  free (inquire);
 }


diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index d2d9f5f..f1c953a 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -1715,7 +1715,7 @@ gfc_free_iterator (gfc_iterator *iter, int flag)
   gfc_free_expr (iter->step);

   if (flag)
-    gfc_free (iter);
+    free (iter);
 }


@@ -1868,7 +1868,7 @@ gfc_match_associate (void)
       continue;

 assocListError:
-      gfc_free (newAssoc);
+      free (newAssoc);
       goto error;
     }
   if (gfc_match_char (')') != MATCH_YES)
@@ -2710,7 +2710,7 @@ gfc_free_alloc_list (gfc_alloc *p)
     {
       q = p->next;
       gfc_free_expr (p->expr);
-      gfc_free (p);
+      free (p);
     }
 }

@@ -3967,7 +3967,7 @@ gfc_free_namelist (gfc_namelist *name)
   for (; name; name = n)
     {
       n = name->next;
-      gfc_free (name);
+      free (name);
     }
 }

@@ -4105,7 +4105,7 @@ gfc_free_equiv_until (gfc_equiv *eq, gfc_equiv *stop)
   gfc_free_equiv (eq->eq);
   gfc_free_equiv_until (eq->next, stop);
   gfc_free_expr (eq->expr);
-  gfc_free (eq);
+  free (eq);
 }


@@ -4368,7 +4368,7 @@ free_case (gfc_case *p)
     p->high = NULL;
   gfc_free_expr (p->low);
   gfc_free_expr (p->high);
-  gfc_free (p);
+  free (p);
 }


@@ -5005,7 +5005,7 @@ gfc_free_forall_iterator (gfc_forall_iterator *iter)
       gfc_free_expr (iter->start);
       gfc_free_expr (iter->end);
       gfc_free_expr (iter->stride);
-      gfc_free (iter);
+      free (iter);
       iter = next;
     }
 }
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 923f8c6..87c9746 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -229,7 +229,7 @@ free_pi_tree (pointer_info *p)
   free_pi_tree (p->left);
   free_pi_tree (p->right);

-  gfc_free (p);
+  free (p);
 }


@@ -424,7 +424,7 @@ resolve_fixups (fixup_t *f, void *gp)
     {
       next = f->next;
       *(f->pointer) = gp;
-      gfc_free (f);
+      free (f);
     }
 }

@@ -496,7 +496,7 @@ free_rename (void)
   for (; gfc_rename_list; gfc_rename_list = next)
     {
       next = gfc_rename_list->next;
-      gfc_free (gfc_rename_list);
+      free (gfc_rename_list);
     }
 }

@@ -891,7 +891,7 @@ free_true_name (true_name *t)
   free_true_name (t->left);
   free_true_name (t->right);

-  gfc_free (t);
+  free (t);
 }


@@ -1225,7 +1225,7 @@ peek_atom (void)

   a = parse_atom ();
   if (a == ATOM_STRING)
-    gfc_free (atom_string);
+    free (atom_string);

   set_module_locus (&m);
   return a;
@@ -1609,7 +1609,7 @@ mio_allocated_wide_string (const gfc_char_t *s, const size_t length)
     {
       char *quoted = quote_string (s, length);
       write_atom (ATOM_STRING, quoted);
-      gfc_free (quoted);
+      free (quoted);
       return s;
     }
   else
@@ -1618,7 +1618,7 @@ mio_allocated_wide_string (const gfc_char_t *s, const size_t length)

       require_atom (ATOM_STRING);
       unquoted = unquote_string (atom_string);
-      gfc_free (atom_string);
+      free (atom_string);
       return unquoted;
     }
 }
@@ -1644,7 +1644,7 @@ mio_pool_string (const char **stringp)
     {
       require_atom (ATOM_STRING);
       *stringp = atom_string[0] == '\0' ? NULL : gfc_get_string (atom_string);
-      gfc_free (atom_string);
+      free (atom_string);
     }
 }

@@ -1661,7 +1661,7 @@ mio_internal_string (char *string)
     {
       require_atom (ATOM_STRING);
       strcpy (string, atom_string);
-      gfc_free (atom_string);
+      free (atom_string);
     }
 }

@@ -2811,13 +2811,13 @@ mio_gmp_integer (mpz_t *integer)
       if (mpz_set_str (*integer, atom_string, 10))
 	bad_module ("Error converting integer");

-      gfc_free (atom_string);
+      free (atom_string);
     }
   else
     {
       p = mpz_get_str (NULL, 10, *integer);
       write_atom (ATOM_STRING, p);
-      gfc_free (p);
+      free (p);
     }
 }

@@ -2835,7 +2835,7 @@ mio_gmp_real (mpfr_t *real)

       mpfr_init (*real);
       mpfr_set_str (*real, atom_string, 16, GFC_RND_MODE);
-      gfc_free (atom_string);
+      free (atom_string);
     }
   else
     {
@@ -2844,7 +2844,7 @@ mio_gmp_real (mpfr_t *real)
       if (mpfr_nan_p (*real) || mpfr_inf_p (*real))
 	{
 	  write_atom (ATOM_STRING, p);
-	  gfc_free (p);
+	  free (p);
 	  return;
 	}

@@ -2862,8 +2862,8 @@ mio_gmp_real (mpfr_t *real)

       write_atom (ATOM_STRING, atom_string);

-      gfc_free (atom_string);
-      gfc_free (p);
+      free (atom_string);
+      free (p);
     }
 }

@@ -3126,7 +3126,7 @@ mio_expr (gfc_expr **ep)
 	{
 	  require_atom (ATOM_STRING);
 	  e->value.function.name = gfc_get_string (atom_string);
-	  gfc_free (atom_string);
+	  free (atom_string);

 	  mio_integer (&flag);
 	  if (flag)
@@ -3135,7 +3135,7 @@ mio_expr (gfc_expr **ep)
 	    {
 	      require_atom (ATOM_STRING);
 	      e->value.function.isym = gfc_find_function (atom_string);
-	      gfc_free (atom_string);
+	      free (atom_string);
 	    }
 	}

@@ -3417,7 +3417,7 @@ mio_typebound_proc (gfc_typebound_proc** proc)
 	      require_atom (ATOM_STRING);
 	      sym_root = &current_f2k_derived->tb_sym_root;
 	      g->specific_st = gfc_get_tbp_symtree (sym_root, atom_string);
-	      gfc_free (atom_string);
+	      free (atom_string);

 	      g->next = (*proc)->u.generic;
 	      (*proc)->u.generic = g;
@@ -3468,7 +3468,7 @@ mio_full_typebound_tree (gfc_symtree** root)

 	  require_atom (ATOM_STRING);
 	  st = gfc_get_tbp_symtree (root, atom_string);
-	  gfc_free (atom_string);
+	  free (atom_string);

 	  mio_typebound_symtree (st);
 	}
@@ -3751,7 +3751,7 @@ skip_list (void)
 	  break;

 	case ATOM_STRING:
-	  gfc_free (atom_string);
+	  free (atom_string);
 	  break;

 	case ATOM_NAME:
@@ -4059,7 +4059,7 @@ load_equiv (void)
 	  {
 	    head = eq->eq;
 	    gfc_free_expr (eq->expr);
-	    gfc_free (eq);
+	    free (eq);
 	  }
       }

@@ -4661,7 +4661,7 @@ free_written_common (struct written_common *w)
   if (w->right)
     free_written_common (w->right);

-  gfc_free (w);
+  free (w);
 }

 /* Write a common block to the module -- recursive helper function.  */
@@ -5740,7 +5740,7 @@ gfc_use_module (void)
 			       MOD_VERSION, filename);
 	    }

-	  gfc_free (atom_string);
+	  free (atom_string);
 	}

       if (c == '\n')
@@ -5787,10 +5787,10 @@ gfc_free_use_stmts (gfc_use_list *use_stmts)
       for (; use_stmts->rename; use_stmts->rename = next_rename)
 	{
 	  next_rename = use_stmts->rename->next;
-	  gfc_free (use_stmts->rename);
+	  free (use_stmts->rename);
 	}
       next = use_stmts->next;
-      gfc_free (use_stmts);
+      free (use_stmts);
     }
 }

diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 2b70c69..69a6bca 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -70,7 +70,7 @@ gfc_free_omp_clauses (gfc_omp_clauses *c)
   gfc_free_expr (c->chunk_size);
   for (i = 0; i < OMP_LIST_NUM; i++)
     gfc_free_namelist (c->lists[i]);
-  gfc_free (c);
+  free (c);
 }

 /* Match a variable/common block list and construct a namelist from it.  */
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index c116103..920b199 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -327,7 +327,7 @@ gfc_post_options (const char **pfilename)
     gfc_add_include_path (".", true, true);

   if (canon_source_file != gfc_source_file)
-    gfc_free (CONST_CAST (char *, canon_source_file));
+    free (CONST_CAST (char *, canon_source_file));

   /* Decide which form the file will be read in as.  */

diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 7fc3dca..c09589b 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -2925,7 +2925,7 @@ select_type_pop (void)
 {
   gfc_select_type_stack *old = select_type_stack;
   select_type_stack = old->prev;
-  gfc_free (old);
+  free (old);
 }


@@ -3576,7 +3576,7 @@ parse_omp_structured_block (gfc_statement omp_st, bool workshare_stmts_only)
 	      && strcmp (cp->ext.omp_name, new_st.ext.omp_name) != 0))
 	gfc_error ("Name after !$omp critical and !$omp end critical does "
 		   "not match at %C");
-      gfc_free (CONST_CAST (char *, new_st.ext.omp_name));
+      free (CONST_CAST (char *, new_st.ext.omp_name));
       break;
     case EXEC_OMP_END_SINGLE:
       cp->ext.omp_clauses->lists[OMP_LIST_COPYPRIVATE]
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 4cda7a1..7e09e4b 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2185,9 +2185,9 @@ gfc_structure_ctor_component;
 static void
 gfc_free_structure_ctor_component (gfc_structure_ctor_component *comp)
 {
-  gfc_free (comp->name);
+  free (comp->name);
   gfc_free_expr (comp->val);
-  gfc_free (comp);
+  free (comp);
 }


diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 1fef22b..1054233 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1091,7 +1091,7 @@ resolve_structure_cons (gfc_expr *expr, int init)
 		    cl2->next = cl->next;

 		  gfc_free_expr (cl->length);
-		  gfc_free (cl);
+		  free (cl);
 		}

 	      cons->expr->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
@@ -5184,7 +5184,7 @@ check_host_association (gfc_expr *e)
 	      for (n = 0; n < e->rank; n++)
 		mpz_clear (e->shape[n]);

-	      gfc_free (e->shape);
+	      free (e->shape);
 	    }

 	  /* Give the expression the right symtree!  */
@@ -8630,7 +8630,7 @@ gfc_resolve_forall (gfc_code *code, gfc_namespace *ns, int forall_save)
       gcc_assert (forall_save == 0);

       /* VAR_EXPR is not needed any more.  */
-      gfc_free (var_expr);
+      free (var_expr);
       total_var = 0;
     }
 }
@@ -13171,7 +13171,7 @@ resolve_equivalence (gfc_equiv *eq)
 		  e->ts.u.cl = NULL;
 		}
 	      ref = ref->next;
-	      gfc_free (mem);
+	      free (mem);
 	    }

 	  /* Any further ref is an error.  */
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index ac26a80..f7e1beb 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -288,15 +288,15 @@ gfc_scanner_done_1 (void)
   while(line_head != NULL) 
     {
       lb = line_head->next;
-      gfc_free(line_head);
+      free (line_head);
       line_head = lb;
     }
      
   while(file_head != NULL) 
     {
       f = file_head->next;
-      gfc_free(file_head->filename);
-      gfc_free(file_head);
+      free (file_head->filename);
+      free (file_head);
       file_head = f;    
     }
 }
@@ -371,19 +371,19 @@ gfc_release_include_path (void)
     {
       p = include_dirs;
       include_dirs = include_dirs->next;
-      gfc_free (p->path);
-      gfc_free (p);
+      free (p->path);
+      free (p);
     }

   while (intrinsic_modules_dirs != NULL)
     {
       p = intrinsic_modules_dirs;
       intrinsic_modules_dirs = intrinsic_modules_dirs->next;
-      gfc_free (p->path);
-      gfc_free (p);
+      free (p->path);
+      free (p);
     }

-  gfc_free (gfc_option.module_dir);
+  free (gfc_option.module_dir);
 }


@@ -659,7 +659,7 @@ gfc_define_undef_line (void)
       tmp = gfc_widechar_to_char (&gfc_current_locus.nextc[8], -1);
       (*debug_hooks->define) (gfc_linebuf_linenum (gfc_current_locus.lb),
 			      tmp);
-      gfc_free (tmp);
+      free (tmp);
     }

   if (wide_strncmp (gfc_current_locus.nextc, "#undef ", 7) == 0)
@@ -667,7 +667,7 @@ gfc_define_undef_line (void)
       tmp = gfc_widechar_to_char (&gfc_current_locus.nextc[7], -1);
       (*debug_hooks->undef) (gfc_linebuf_linenum (gfc_current_locus.lb),
 			     tmp);
-      gfc_free (tmp);
+      free (tmp);
     }

   /* Skip the rest of the line.  */
@@ -1760,8 +1760,8 @@ preprocessor_line (gfc_char_t *c)
 			   current_file->filename, current_file->line,
 			   filename);
 	  if (unescape)
-	    gfc_free (wide_filename);
-	  gfc_free (filename);
+	    free (wide_filename);
+	  free (filename);
 	  return;
 	}

@@ -1785,8 +1785,8 @@ preprocessor_line (gfc_char_t *c)
   /* Set new line number.  */
   current_file->line = line;
   if (unescape)
-    gfc_free (wide_filename);
-  gfc_free (filename);
+    free (wide_filename);
+  free (filename);
   return;

  bad_cpp_line:
@@ -1870,7 +1870,7 @@ include_line (gfc_char_t *line)
   if (load_file (filename, NULL, false) == FAILURE)
     exit (FATAL_EXIT_CODE);

-  gfc_free (filename);
+  free (filename);
   return true;
 }

@@ -1939,12 +1939,12 @@ load_file (const char *realfilename, const char *displayedname, bool initial)
   if (initial && gfc_src_preprocessor_lines[0])
     {
       preprocessor_line (gfc_src_preprocessor_lines[0]);
-      gfc_free (gfc_src_preprocessor_lines[0]);
+      free (gfc_src_preprocessor_lines[0]);
       gfc_src_preprocessor_lines[0] = NULL;
       if (gfc_src_preprocessor_lines[1])
 	{
 	  preprocessor_line (gfc_src_preprocessor_lines[1]);
-	  gfc_free (gfc_src_preprocessor_lines[1]);
+	  free (gfc_src_preprocessor_lines[1]);
 	  gfc_src_preprocessor_lines[1] = NULL;
 	}
     }
@@ -1975,7 +1975,7 @@ load_file (const char *realfilename, const char *displayedname, bool initial)
 	  gfc_char_t *new_char = gfc_get_wide_string (line_len);

 	  wide_strcpy (new_char, &line[n]);
-	  gfc_free (line);
+	  free (line);
 	  line = new_char;
 	  len -= n;
 	}
@@ -2033,7 +2033,7 @@ load_file (const char *realfilename, const char *displayedname, bool initial)
     }

   /* Release the line buffer allocated in load_line.  */
-  gfc_free (line);
+  free (line);

   fclose (input);

@@ -2145,7 +2145,7 @@ gfc_read_orig_filename (const char *filename, const char **canon_source_file)

   tmp = gfc_widechar_to_char (&gfc_src_preprocessor_lines[0][5], -1);
   filename = unescape_filename (tmp);
-  gfc_free (tmp);
+  free (tmp);
   if (filename == NULL)
     return NULL;

@@ -2162,14 +2162,14 @@ gfc_read_orig_filename (const char *filename, const char **canon_source_file)

   tmp = gfc_widechar_to_char (&gfc_src_preprocessor_lines[1][5], -1);
   dirname = unescape_filename (tmp);
-  gfc_free (tmp);
+  free (tmp);
   if (dirname == NULL)
     return filename;

   len = strlen (dirname);
   if (len < 3 || dirname[len - 1] != '/' || dirname[len - 2] != '/')
     {
-      gfc_free (dirname);
+      free (dirname);
       return filename;
     }
   dirname[len - 2] = '\0';
@@ -2185,6 +2185,6 @@ gfc_read_orig_filename (const char *filename, const char **canon_source_file)
       *canon_source_file = p;
     }

-  gfc_free (dirname);
+  free (dirname);
   return filename;
 }
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index bb8b575..f5153cd 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -616,8 +616,8 @@ simplify_transformation_to_array (gfc_expr *result, gfc_expr *array, gfc_expr *d
       result_ctor = gfc_constructor_next (result_ctor);
     }

-  gfc_free (arrayvec);
-  gfc_free (resultvec);
+  free (arrayvec);
+  free (resultvec);
   return result;
 }

@@ -2595,7 +2595,7 @@ gfc_simplify_ibits (gfc_expr *x, gfc_expr *y, gfc_expr *z)
 	gfc_internal_error ("IBITS: Bad bit");
     }

-  gfc_free (bits);
+  free (bits);

   convert_mpz_to_signed (result->value.integer,
 			 gfc_integer_kinds[k].bit_size);
@@ -3087,7 +3087,7 @@ simplify_shift (gfc_expr *e, gfc_expr *s, const char *name,
     }

   convert_mpz_to_signed (result->value.integer, bitsize);
-  gfc_free (bits);
+  free (bits);

   return result;
 }
@@ -3246,7 +3246,7 @@ gfc_simplify_ishftc (gfc_expr *e, gfc_expr *s, gfc_expr *sz)

   convert_mpz_to_signed (result->value.integer, isize);

-  gfc_free (bits);
+  free (bits);
   return result;
 }

@@ -4084,12 +4084,12 @@ min_max_choose (gfc_expr *arg, gfc_expr *extremum, int sign)
 			       LENGTH(arg) - LENGTH(extremum));
 	    STRING(extremum)[LENGTH(arg)] = '\0';  /* For debugger  */
 	    LENGTH(extremum) = LENGTH(arg);
-	    gfc_free (tmp);
+	    free (tmp);
 	  }

 	if (gfc_compare_string (arg, extremum) * sign > 0)
 	  {
-	    gfc_free (STRING(extremum));
+	    free (STRING(extremum));
 	    STRING(extremum) = gfc_get_wide_string (LENGTH(extremum) + 1);
 	    memcpy (STRING(extremum), STRING(arg),
 		      LENGTH(arg) * sizeof (gfc_char_t));
@@ -6833,7 +6833,7 @@ gfc_simplify_compiler_options (void)
   str = gfc_get_option_string ();
   result = gfc_get_character_expr (gfc_default_character_kind,
 				   &gfc_current_locus, str, strlen (str));
-  gfc_free (str);
+  free (str);
   return result;
 }

diff --git a/gcc/fortran/st.c b/gcc/fortran/st.c
index 28d69b9..6f8a234 100644
--- a/gcc/fortran/st.c
+++ b/gcc/fortran/st.c
@@ -193,7 +193,7 @@ gfc_free_statement (gfc_code *p)
       break;

     case EXEC_OMP_CRITICAL:
-      gfc_free (CONST_CAST (char *, p->ext.omp_name));
+      free (CONST_CAST (char *, p->ext.omp_name));
       break;

     case EXEC_OMP_FLUSH:
@@ -228,7 +228,7 @@ gfc_free_statements (gfc_code *p)
       if (p->block)
 	gfc_free_statements (p->block);
       gfc_free_statement (p);
-      gfc_free (p);
+      free (p);
     }
 }

@@ -242,5 +242,5 @@ gfc_free_association_list (gfc_association_list* assoc)
     return;

   gfc_free_association_list (assoc->next);
-  gfc_free (assoc);
+  free (assoc);
 }
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 71aa518..4b4f75f 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -2060,7 +2060,7 @@ free_components (gfc_component *p)
       gfc_free_formal_arglist (p->formal);
       gfc_free_namespace (p->formal_ns);

-      gfc_free (p);
+      free (p);
     }
 }

@@ -2096,7 +2096,7 @@ gfc_free_st_label (gfc_st_label *label)
   if (label->format != NULL)
     gfc_free_expr (label->format);

-  gfc_free (label);
+  free (label);
 }


@@ -2114,7 +2114,7 @@ free_st_labels (gfc_st_label *label)
   
   if (label->format != NULL)
     gfc_free_expr (label->format);
-  gfc_free (label);
+  free (label);
 }


@@ -2375,7 +2375,7 @@ gfc_delete_symtree (gfc_symtree **root, const char *name)
   st.name = gfc_get_string (name);
   gfc_delete_bbt (root, &st, compare_symtree);

-  gfc_free (st0);
+  free (st0);
 }


@@ -2481,7 +2481,7 @@ gfc_free_symbol (gfc_symbol *sym)

   gfc_free_namespace (sym->f2k_derived);

-  gfc_free (sym);
+  free (sym);
 }


@@ -2918,7 +2918,7 @@ gfc_undo_symbols (void)
 	  p->formal = old->formal;
 	}

-      gfc_free (p->old_symbol);
+      free (p->old_symbol);
       p->old_symbol = NULL;
       p->tlink = NULL;
     }
@@ -2929,7 +2929,7 @@ gfc_undo_symbols (void)
     {
       tbq = tbp->next;
       /* Procedure is already marked `error' by default.  */
-      gfc_free (tbp);
+      free (tbp);
     }
   tentative_tbp_list = NULL;
 }
@@ -2957,7 +2957,7 @@ free_old_symbol (gfc_symbol *sym)
   if (sym->old_symbol->formal != sym->formal)
     gfc_free_formal_arglist (sym->old_symbol->formal);

-  gfc_free (sym->old_symbol);
+  free (sym->old_symbol);
   sym->old_symbol = NULL;
 }

@@ -2985,7 +2985,7 @@ gfc_commit_symbols (void)
     {
       tbq = tbp->next;
       tbp->proc->error = 0;
-      gfc_free (tbp);
+      free (tbp);
     }
   tentative_tbp_list = NULL;
 }
@@ -3033,7 +3033,7 @@ free_tb_tree (gfc_symtree *t)
   /* TODO: Free type-bound procedure structs themselves; probably needs some
      sort of ref-counting mechanism.  */

-  gfc_free (t);
+  free (t);
 }


@@ -3049,7 +3049,7 @@ free_common_tree (gfc_symtree * common_tree)
   free_common_tree (common_tree->left);
   free_common_tree (common_tree->right);

-  gfc_free (common_tree);
+  free (common_tree);
 }  


@@ -3066,8 +3066,8 @@ free_uop_tree (gfc_symtree *uop_tree)
   free_uop_tree (uop_tree->right);

   gfc_free_interface (uop_tree->n.uop->op);
-  gfc_free (uop_tree->n.uop);
-  gfc_free (uop_tree);
+  free (uop_tree->n.uop);
+  free (uop_tree);
 }


@@ -3084,7 +3084,7 @@ free_sym_tree (gfc_symtree *sym_tree)
   free_sym_tree (sym_tree->right);

   gfc_release_symbol (sym_tree->n.sym);
-  gfc_free (sym_tree);
+  free (sym_tree);
 }


@@ -3098,7 +3098,7 @@ gfc_free_dt_list (void)
   for (dt = gfc_derived_types; dt; dt = n)
     {
       n = dt->next;
-      gfc_free (dt);
+      free (dt);
     }

   gfc_derived_types = NULL;
@@ -3113,7 +3113,7 @@ gfc_free_equiv_infos (gfc_equiv_info *s)
   if (s == NULL)
     return;
   gfc_free_equiv_infos (s->next);
-  gfc_free (s);
+  free (s);
 }


@@ -3126,7 +3126,7 @@ gfc_free_equiv_lists (gfc_equiv_list *l)
     return;
   gfc_free_equiv_lists (l->next);
   gfc_free_equiv_infos (l->equiv);
-  gfc_free (l);
+  free (l);
 }


@@ -3138,7 +3138,7 @@ gfc_free_finalizer (gfc_finalizer* el)
   if (el)
     {
       gfc_release_symbol (el->proc_sym);
-      gfc_free (el);
+      free (el);
     }
 }

@@ -3204,7 +3204,7 @@ void gfc_free_charlen (gfc_charlen *cl, gfc_charlen *end)

       cl2 = cl->next;
       gfc_free_expr (cl->length);
-      gfc_free (cl);
+      free (cl);
     }
 }

@@ -3220,7 +3220,7 @@ free_entry_list (gfc_entry_list *el)
     return;

   next = el->next;
-  gfc_free (el);
+  free (el);
   free_entry_list (next);
 }

@@ -3264,7 +3264,7 @@ gfc_free_namespace (gfc_namespace *ns)

   gfc_free_data (ns->data);
   p = ns->contained;
-  gfc_free (ns);
+  free (ns);

   /* Recursively free any contained namespaces.  */
   while (p != NULL)
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index ac08c42..5e4e631 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -485,7 +485,7 @@ gfc_free_ss (gfc_ss * ss)
       break;
     }

-  gfc_free (ss);
+  free (ss);
 }


@@ -2409,7 +2409,7 @@ gfc_trans_array_bound_check (gfc_se * se, tree descriptor, tree index, int n,
 			       fold_convert (long_integer_type_node, index),
 			       fold_convert (long_integer_type_node, tmp_lo),
 			       fold_convert (long_integer_type_node, tmp_up));
-      gfc_free (msg);
+      free (msg);
     }
   else
     {
@@ -2427,7 +2427,7 @@ gfc_trans_array_bound_check (gfc_se * se, tree descriptor, tree index, int n,
       gfc_trans_runtime_check (true, false, fault, &se->pre, where, msg,
 			       fold_convert (long_integer_type_node, index),
 			       fold_convert (long_integer_type_node, tmp_lo));
-      gfc_free (msg);
+      free (msg);
     }

   return index;
@@ -2645,7 +2645,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym,
 				   fold_convert (long_integer_type_node,
 						 indexse.expr),
 				   fold_convert (long_integer_type_node, tmp));
-	  gfc_free (msg);
+	  free (msg);

 	  /* Upper bound, but not for the last dimension of assumed-size
 	     arrays.  */
@@ -2669,7 +2669,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym,
 				   fold_convert (long_integer_type_node,
 						 indexse.expr),
 				   fold_convert (long_integer_type_node, tmp));
-	      gfc_free (msg);
+	      free (msg);
 	    }
 	}

@@ -3264,7 +3264,7 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
 			"of array '%s'", dim + 1, ss->expr->symtree->name);
 	      gfc_trans_runtime_check (true, false, tmp, &inner,
 				       &ss->expr->where, msg);
-	      gfc_free (msg);
+	      free (msg);

 	      desc = ss->data.info.descriptor;

@@ -3331,7 +3331,7 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
 		     fold_convert (long_integer_type_node, info->start[dim]),
 		     fold_convert (long_integer_type_node, lbound),
 		     fold_convert (long_integer_type_node, ubound));
-		  gfc_free (msg);
+		  free (msg);
 		}
 	      else
 		{
@@ -3347,7 +3347,7 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
 					   &ss->expr->where, msg,
 		     fold_convert (long_integer_type_node, info->start[dim]),
 		     fold_convert (long_integer_type_node, lbound));
-		  gfc_free (msg);
+		  free (msg);
 		}
 	      
 	      /* Compute the last element of the range, which is not
@@ -3385,7 +3385,7 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
 		     fold_convert (long_integer_type_node, tmp),
 		     fold_convert (long_integer_type_node, ubound), 
 		     fold_convert (long_integer_type_node, lbound));
-		  gfc_free (msg);
+		  free (msg);
 		}
 	      else
 		{
@@ -3396,7 +3396,7 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
 					   &ss->expr->where, msg,
 		     fold_convert (long_integer_type_node, tmp),
 		     fold_convert (long_integer_type_node, lbound));
-		  gfc_free (msg);
+		  free (msg);
 		}

 	      /* Check the section sizes match.  */
@@ -3427,7 +3427,7 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop)
 			fold_convert (long_integer_type_node, tmp),
 			fold_convert (long_integer_type_node, size[n]));

-		  gfc_free (msg);
+		  free (msg);
 		}
 	      else
 		size[n] = gfc_evaluate_now (tmp, &inner);
@@ -5019,7 +5019,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc,
 			fold_convert (long_integer_type_node, temp),
 			fold_convert (long_integer_type_node, stride2));

-	      gfc_free (msg);
+	      free (msg);
 	    }
 	}
       else
@@ -6179,7 +6179,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, bool g77,

 	  gfc_trans_runtime_check (false, true, tmp, &se->pre,
 				   &expr->where, msg);
-	  gfc_free (msg);
+	  free (msg);
 	}

       gfc_start_block (&block);
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index ad4ef06..a2b2605 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -521,8 +521,8 @@ get_init_field (segment_info *head, tree union_type, tree *field_init,
   for (i = 0; i < length; i++)
     CONSTRUCTOR_APPEND_ELT (v, NULL, build_int_cst (type, data[i]));

-  gfc_free (data);
-  gfc_free (chk);
+  free (data);
+  free (chk);

   /* Build a char[length] array to hold the initializers.  Much of what
      follows is borrowed from build_field, above.  */
@@ -720,7 +720,7 @@ create_common (gfc_common_head *com, segment_info *head, bool saw_equiv)
       s->sym->backend_decl = var_decl;

       next_s = s->next;
-      gfc_free (s);
+      free (s);
     }
 }

diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c
index 3d8d4ef..30739d8 100644
--- a/gcc/fortran/trans-const.c
+++ b/gcc/fortran/trans-const.c
@@ -102,7 +102,7 @@ gfc_build_wide_string_const (int kind, int length, const gfc_char_t *string)
   gfc_encode_character (kind, length, string, (unsigned char *) s, size);

   str = build_string (size, s);
-  gfc_free (s);
+  free (s);

   len = build_int_cst (NULL_TREE, length);
   TREE_TYPE (str) =
@@ -164,7 +164,7 @@ gfc_conv_string_init (tree length, gfc_expr * expr)
   str = gfc_build_wide_string_const (expr->ts.kind, len, s);

   if (free_s)
-    gfc_free (s);
+    free (s);

   return str;
 }
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 08207e0..ae20b74 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -4784,7 +4784,7 @@ gfc_generate_function_code (gfc_namespace * ns)
       gfc_trans_runtime_check (true, false, recurcheckvar, &init,
 			       &sym->declared_at, msg);
       gfc_add_modify (&init, recurcheckvar, boolean_true_node);
-      gfc_free (msg);
+      free (msg);
     }

   /* Now generate the code for the body of this function.  */
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index da7cfba..c3853ab 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -449,7 +449,7 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int kind,
       gfc_trans_runtime_check (true, false, fault, &se->pre, where, msg,
 			       fold_convert (long_integer_type_node,
 					     start.expr));
-      gfc_free (msg);
+      free (msg);

       /* Check upper bound.  */
       fault = fold_build2_loc (input_location, GT_EXPR, boolean_type_node,
@@ -466,7 +466,7 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int kind,
 			       fold_convert (long_integer_type_node, end.expr),
 			       fold_convert (long_integer_type_node,
 					     se->string_length));
-      gfc_free (msg);
+      free (msg);
     }

   /* If the start and end expressions are equal, the length is one.  */
@@ -1736,14 +1736,14 @@ gfc_free_interface_mapping (gfc_interface_mapping * mapping)
       sym->new_sym->n.sym->formal = NULL;
       gfc_free_symbol (sym->new_sym->n.sym);
       gfc_free_expr (sym->expr);
-      gfc_free (sym->new_sym);
-      gfc_free (sym);
+      free (sym->new_sym);
+      free (sym);
     }
   for (cl = mapping->charlens; cl; cl = nextcl)
     {
       nextcl = cl->next;
       gfc_free_expr (cl->length);
-      gfc_free (cl);
+      free (cl);
     }
 }

@@ -3335,7 +3335,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
  
 	  gfc_trans_runtime_check (true, false, cond, &se->pre, &e->where,
 				   msg);
-	  gfc_free (msg);
+	  free (msg);
         }
       end_pointer_check:

@@ -4042,7 +4042,7 @@ gfc_conv_statement_function (gfc_se * se, gfc_expr * expr)
   /* Restore the original variables.  */
   for (fargs = sym->formal, n = 0; fargs; fargs = fargs->next, n++)
     gfc_restore_sym (fargs->sym, &saved_vars[n]);
-  gfc_free (saved_vars);
+  free (saved_vars);
 }


@@ -4311,7 +4311,7 @@ gfc_trans_subarray_assign (tree dest, gfc_component * cm, gfc_expr * expr)

   for (n = 0; n < cm->as->rank; n++)
     mpz_clear (lss->shape[n]);
-  gfc_free (lss->shape);
+  free (lss->shape);

   gfc_cleanup_loop (&loop);

diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 403aa30..8e2b9ad 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -3901,7 +3901,7 @@ conv_generic_with_optional_char_arg (gfc_se* se, gfc_expr* expr,
   sym = gfc_get_symbol_for_expr (expr);
   gfc_conv_procedure_call (se, sym, expr->value.function.actual, expr,
 			  append_args);
-  gfc_free (sym);
+  free (sym);
 }


diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index f6a783f..26b0afb 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -252,7 +252,7 @@ gfc_trans_io_runtime_check (tree cond, tree var, int error_code,
   asprintf (&message, "%s", _(msgid));
   arg3 = gfc_build_addr_expr (pchar_type_node,
 			      gfc_build_localized_cstring_const (message));
-  gfc_free(message);
+  free (message);
   
   tmp = build_call_expr_loc (input_location,
 			 gfor_fndecl_generate_error, 3, arg1, arg2, arg3);
@@ -717,7 +717,7 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
 	       "label", e->symtree->name);
       gfc_trans_runtime_check (true, false, cond, &se.pre, &e->where, msg,
 			       fold_convert (long_integer_type_node, tmp));
-      gfc_free (msg);
+      free (msg);

       gfc_add_modify (&se.pre, io,
 		 fold_convert (TREE_TYPE (io), GFC_DECL_ASSIGN_ADDR (se.expr)));
@@ -1633,7 +1633,7 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
 	  transfer_namelist_element (block,
 				     full_name,
 				     NULL, cmp, expr);
-	  gfc_free (full_name);
+	  free (full_name);
 	}
     }
 }
@@ -2007,7 +2007,7 @@ transfer_array_component (tree expr, gfc_component * cm, locus * where)

   for (n = 0; n < cm->as->rank; n++)
     mpz_clear (ss->shape[n]);
-  gfc_free (ss->shape);
+  free (ss->shape);

   gfc_cleanup_loop (&loop);

diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 53eb999..c86577c 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -711,11 +711,11 @@ gfc_trans_omp_array_reduction (tree c, gfc_symbol *sym, locus where)
   gfc_free_expr (e2);
   gfc_free_expr (e3);
   gfc_free_expr (e4);
-  gfc_free (symtree1);
-  gfc_free (symtree2);
-  gfc_free (symtree3);
+  free (symtree1);
+  free (symtree2);
+  free (symtree3);
   if (symtree4)
-    gfc_free (symtree4);
+    free (symtree4);
   gfc_free_array_spec (outer_sym.as);
 }

diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 98fb74c..580bea0 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -2339,8 +2339,8 @@ cleanup_forall_symtrees (gfc_code *c)
 {
   forall_restore_symtree (c->expr1);
   forall_restore_symtree (c->expr2);
-  gfc_free (new_symtree->n.sym);
-  gfc_free (new_symtree);
+  free (new_symtree->n.sym);
+  free (new_symtree);
 }


@@ -3560,22 +3560,22 @@ gfc_trans_forall_1 (gfc_code * code, forall_info * nested_forall_info)
     gfc_restore_sym (fa->var->symtree->n.sym, &saved_vars[n]);

   /* Free the space for var, start, end, step, varexpr.  */
-  gfc_free (var);
-  gfc_free (start);
-  gfc_free (end);
-  gfc_free (step);
-  gfc_free (varexpr);
-  gfc_free (saved_vars);
+  free (var);
+  free (start);
+  free (end);
+  free (step);
+  free (varexpr);
+  free (saved_vars);

   for (this_forall = info->this_loop; this_forall;)
     {
       iter_info *next = this_forall->next;
-      gfc_free (this_forall);
+      free (this_forall);
       this_forall = next;
     }

   /* Free the space for this forall_info.  */
-  gfc_free (info);
+  free (info);

   if (pmask)
     {
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 27a352a..5237d0e 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -407,12 +407,12 @@ trans_runtime_error_vararg (bool error, locus* where, const char* msgid,

   arg = gfc_build_addr_expr (pchar_type_node,
 			     gfc_build_localized_cstring_const (message));
-  gfc_free(message);
+  free (message);
   
   asprintf (&message, "%s", _(msgid));
   arg2 = gfc_build_addr_expr (pchar_type_node,
 			      gfc_build_localized_cstring_const (message));
-  gfc_free(message);
+  free (message);

   /* Build the argument array.  */
   argarray = XALLOCAVEC (tree, nargs + 2);
@@ -1153,7 +1153,7 @@ void
 gfc_restore_backend_locus (locus * loc)
 {
   gfc_set_backend_locus (loc);
-  gfc_free (loc->lb);
+  free (loc->lb);
 }


-- 
1.7.4.1.408.gb6b16

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH gcc/fortran] get rid of gfc_free
  2011-03-15 10:03         ` [PATCH gcc/fortran] get rid of gfc_free Jim Meyering
@ 2011-03-15 10:08           ` Jakub Jelinek
  2011-03-15 10:27             ` Jim Meyering
  2011-03-15 14:18           ` Janne Blomqvist
  1 sibling, 1 reply; 31+ messages in thread
From: Jakub Jelinek @ 2011-03-15 10:08 UTC (permalink / raw)
  To: Jim Meyering
  Cc: Janne Blomqvist, Joseph S. Myers, gcc-patches, java-patches, fortran

On Tue, Mar 15, 2011 at 11:02:38AM +0100, Jim Meyering wrote:
> > Instead of "please let us know", maybe recommend using
> > __builtin_expect instead? E.g. something like
> >
> > if (__builtin_expect (ptr != NULL, 0))
> >     free (ptr);
> 
> Good idea.  Thanks.
> Though how about avoiding the double negative?
> 
>    if (__builtin_expect (ptr == NULL, 1))
>      free (ptr);

What double negative?  if (__builtin_expect (ptr != NULL, 0)) free (ptr);
is certainly correct, the latter is wrong, it will leak memory.
It will call free only if ptr is NULL, i.e. do a useless free (NULL),
if it is non-NULL, it will not do anything.
You could do
  if (!__builtin_expect (ptr == NULL, 1))
    free (ptr);
but that doesn't seem to be nicer or clearer than
  if (__builtin_expect (ptr != NULL, 0))
    free (ptr);

	Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH gcc/fortran] get rid of gfc_free
  2011-03-15 10:08           ` Jakub Jelinek
@ 2011-03-15 10:27             ` Jim Meyering
  0 siblings, 0 replies; 31+ messages in thread
From: Jim Meyering @ 2011-03-15 10:27 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Janne Blomqvist, Joseph S. Myers, gcc-patches, java-patches, fortran

Jakub Jelinek wrote:
> On Tue, Mar 15, 2011 at 11:02:38AM +0100, Jim Meyering wrote:
>> > Instead of "please let us know", maybe recommend using
>> > __builtin_expect instead? E.g. something like
>> >
>> > if (__builtin_expect (ptr != NULL, 0))
>> >     free (ptr);
>>
>> Good idea.  Thanks.
>> Though how about avoiding the double negative?
>>
>>    if (__builtin_expect (ptr == NULL, 1))
>>      free (ptr);
>
> What double negative?  if (__builtin_expect (ptr != NULL, 0)) free (ptr);
> is certainly correct, the latter is wrong, it will leak memory.
> It will call free only if ptr is NULL, i.e. do a useless free (NULL),
> if it is non-NULL, it will not do anything.
> You could do
>   if (!__builtin_expect (ptr == NULL, 1))
>     free (ptr);
> but that doesn't seem to be nicer or clearer than
>   if (__builtin_expect (ptr != NULL, 0))
>     free (ptr);

Thanks for the quick correction.
I've fixed it locally, too.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH gcc/fortran] get rid of gfc_free
  2011-03-15 10:03         ` [PATCH gcc/fortran] get rid of gfc_free Jim Meyering
  2011-03-15 10:08           ` Jakub Jelinek
@ 2011-03-15 14:18           ` Janne Blomqvist
  2011-03-15 18:21             ` Jim Meyering
  1 sibling, 1 reply; 31+ messages in thread
From: Janne Blomqvist @ 2011-03-15 14:18 UTC (permalink / raw)
  To: Jim Meyering; +Cc: Joseph S. Myers, gcc-patches, java-patches, fortran

On Tue, Mar 15, 2011 at 12:02, Jim Meyering <jim@meyering.net> wrote:
> 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.
>
> Hi Janne,
>
> These requested changes are in addition to (and independent of)
> the changes that I've already posted here.

Yes, it was perhaps a bit unreasonable to ask you to fix this. OTOH
with your changes gfc_free() was just a wrapper around free() and
should thus be removed as unnecessary. Also, I believe this "proper"
fix is more in the spirit of the request by Tobias and the message he
linked to discussing the removal of gfc_free().

> The first cset below
> does your #2 and #3, and the second does #1.  I separate them for
> review because #1 is completely mechanical, while the others
> are manual.  You may prefer to combine them before pushing, for
> bisection.  Let me know if you'd prefer I submit in that form.

All 3 changesets are ok for 4.7.

I think it's fine to commit them separately if you prefer. If so,
preferably in the order #3, #1, #2 in order to keep every revision
buildable.

Thanks for working on this!

-- 
Janne Blomqvist

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH gcc/fortran] get rid of gfc_free
  2011-03-15 14:18           ` Janne Blomqvist
@ 2011-03-15 18:21             ` Jim Meyering
  0 siblings, 0 replies; 31+ messages in thread
From: Jim Meyering @ 2011-03-15 18:21 UTC (permalink / raw)
  To: Janne Blomqvist; +Cc: Joseph S. Myers, gcc-patches, java-patches, fortran

Janne Blomqvist wrote:
...
>> Hi Janne,
>>
>> These requested changes are in addition to (and independent of)
>> the changes that I've already posted here.
>
> Yes, it was perhaps a bit unreasonable to ask you to fix this. OTOH
> with your changes gfc_free() was just a wrapper around free() and
> should thus be removed as unnecessary. Also, I believe this "proper"
> fix is more in the spirit of the request by Tobias and the message he
> linked to discussing the removal of gfc_free().
>
>> The first cset below
>> does your #2 and #3, and the second does #1.  I separate them for
>> review because #1 is completely mechanical, while the others
>> are manual.  You may prefer to combine them before pushing, for
>> bisection.  Let me know if you'd prefer I submit in that form.
>
> All 3 changesets are ok for 4.7.
>
> I think it's fine to commit them separately if you prefer. If so,
> preferably in the order #3, #1, #2 in order to keep every revision
> buildable.
>
> Thanks for working on this!

Just so we're clear...
Currently while I do have a sourceware account,
I'm not in the gcc group, so don't have commit access,

    sourceware$ id -a|grep gcc
    [Exit 1]

so someone else would have to commit my changes.
Or add me to the "gcc" group and I will do it.

Another recently-approved change may be in limbo for this reason:

    avoid memory overrun in a test leading to potential double-free
    * testsuite/test-expandargv.c (writeout_test): Fix off-by-one error:
    i.e., do copy the trailing NUL byte.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v3] Re: avoid useless if-before-free tests
  2011-03-15  9:19       ` Janne Blomqvist
  2011-03-15 10:03         ` [PATCH gcc/fortran] get rid of gfc_free Jim Meyering
@ 2011-03-24 16:51         ` Jim Meyering
  2011-04-15  7:26           ` Janne Blomqvist
  1 sibling, 1 reply; 31+ messages in thread
From: Jim Meyering @ 2011-03-24 16:51 UTC (permalink / raw)
  To: Janne Blomqvist; +Cc: Joseph S. Myers, gcc-patches, java-patches, fortran

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

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v3] Re: avoid useless if-before-free tests
  2011-03-24 16:51         ` [PATCH v3] Re: avoid useless if-before-free tests Jim Meyering
@ 2011-04-15  7:26           ` Janne Blomqvist
  2011-04-15  7:54             ` Jim Meyering
  0 siblings, 1 reply; 31+ messages in thread
From: Janne Blomqvist @ 2011-04-15  7:26 UTC (permalink / raw)
  To: Jim Meyering; +Cc: Joseph S. Myers, gcc-patches, java-patches, fortran

On Thu, Mar 24, 2011 at 18:51, Jim Meyering <jim@meyering.net> wrote:
> 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:

[snip]

So, what's the plan here? Do you plan to get a GCC account, do you
already have one, or what? Now that 4.7 is open for development, it's
perhaps the right time to poke the maintainers to get this patch in.

If you don't have a GCC account, as one of the Fortran maintainers I
can commit the Fortran and libgfortran parts, but someone else will
have to do the rest (were they ever approved, BTW?) as I have only
write after approval privileges for the rest of GCC.


-- 
Janne Blomqvist

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v3] Re: avoid useless if-before-free tests
  2011-04-15  7:26           ` Janne Blomqvist
@ 2011-04-15  7:54             ` Jim Meyering
  2011-04-15  8:20               ` Janne Blomqvist
  0 siblings, 1 reply; 31+ messages in thread
From: Jim Meyering @ 2011-04-15  7:54 UTC (permalink / raw)
  To: Janne Blomqvist; +Cc: Joseph S. Myers, gcc-patches, java-patches, fortran

Janne Blomqvist wrote:

> On Thu, Mar 24, 2011 at 18:51, Jim Meyering <jim@meyering.net> wrote:
>> 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:
>
> [snip]
>
> So, what's the plan here? Do you plan to get a GCC account, do you
> already have one, or what? Now that 4.7 is open for development, it's
> perhaps the right time to poke the maintainers to get this patch in.
>
> If you don't have a GCC account, as one of the Fortran maintainers I
> can commit the Fortran and libgfortran parts, but someone else will
> have to do the rest (were they ever approved, BTW?) as I have only
> write after approval privileges for the rest of GCC.

Can someone add me to the gcc group?  That would help.
I already have ssh access to sourceware.org.

I've rebased the series a few times, but it's been a week or so.
More convertible uses are being added regularly.
Plus I have to reorder/split things a little to avoid a new conflict.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v3] Re: avoid useless if-before-free tests
  2011-04-15  7:54             ` Jim Meyering
@ 2011-04-15  8:20               ` Janne Blomqvist
  2011-04-15  8:23                 ` Jim Meyering
  2011-04-15 13:20                 ` Tom Tromey
  0 siblings, 2 replies; 31+ messages in thread
From: Janne Blomqvist @ 2011-04-15  8:20 UTC (permalink / raw)
  To: Jim Meyering
  Cc: Joseph S. Myers, gcc-patches, java-patches, fortran, gcc mailing list

On Fri, Apr 15, 2011 at 10:54, Jim Meyering <jim@meyering.net> wrote:
> Janne Blomqvist wrote:
>
>> On Thu, Mar 24, 2011 at 18:51, Jim Meyering <jim@meyering.net> wrote:
>>> 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:
>>
>> [snip]
>>
>> So, what's the plan here? Do you plan to get a GCC account, do you
>> already have one, or what? Now that 4.7 is open for development, it's
>> perhaps the right time to poke the maintainers to get this patch in.
>>
>> If you don't have a GCC account, as one of the Fortran maintainers I
>> can commit the Fortran and libgfortran parts, but someone else will
>> have to do the rest (were they ever approved, BTW?) as I have only
>> write after approval privileges for the rest of GCC.
>
> Can someone add me to the gcc group?  That would help.
> I already have ssh access to sourceware.org.

According to http://gcc.gnu.org/svnwrite.html , you should send an
email to overseers(at)gcc.gnu.org . It says that you need a sponsor
and "The steering committee or a well-established GCC maintainer
(including reviewers) can approve for write access any person with GNU
copyright assignment papers in place and known to submit good
patches.". I'm not sure if I'm considered to be well-established
enough, so could someone help Jim out here, please?

Or, if nobody pipes up within a few days, just mention my name as your
sponsor and we'll see if the overseers consider me well-established or
not.. ;)


-- 
Janne Blomqvist

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v3] Re: avoid useless if-before-free tests
  2011-04-15  8:20               ` Janne Blomqvist
@ 2011-04-15  8:23                 ` Jim Meyering
  2011-04-15 13:20                 ` Tom Tromey
  1 sibling, 0 replies; 31+ messages in thread
From: Jim Meyering @ 2011-04-15  8:23 UTC (permalink / raw)
  To: Janne Blomqvist
  Cc: Joseph S. Myers, gcc-patches, java-patches, fortran, gcc mailing list

Janne Blomqvist wrote:
> On Fri, Apr 15, 2011 at 10:54, Jim Meyering <jim@meyering.net> wrote:
>> Janne Blomqvist wrote:
>>
>>> On Thu, Mar 24, 2011 at 18:51, Jim Meyering <jim@meyering.net> wrote:
>>>> 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:
>>>
>>> [snip]
>>>
>>> So, what's the plan here? Do you plan to get a GCC account, do you
>>> already have one, or what? Now that 4.7 is open for development, it's
>>> perhaps the right time to poke the maintainers to get this patch in.
>>>
>>> If you don't have a GCC account, as one of the Fortran maintainers I
>>> can commit the Fortran and libgfortran parts, but someone else will
>>> have to do the rest (were they ever approved, BTW?) as I have only
>>> write after approval privileges for the rest of GCC.
>>
>> Can someone add me to the gcc group?  That would help.
>> I already have ssh access to sourceware.org.
>
> According to http://gcc.gnu.org/svnwrite.html , you should send an
> email to overseers(at)gcc.gnu.org . It says that you need a sponsor
> and "The steering committee or a well-established GCC maintainer
> (including reviewers) can approve for write access any person with GNU
> copyright assignment papers in place and known to submit good
> patches.". I'm not sure if I'm considered to be well-established
> enough, so could someone help Jim out here, please?
>
> Or, if nobody pipes up within a few days, just mention my name as your
> sponsor and we'll see if the overseers consider me well-established or
> not.. ;)

Thanks.
FYI, I have an "ANY" assignment on file, so no need to wait for paperwork.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v3] Re: avoid useless if-before-free tests
  2011-04-15  8:20               ` Janne Blomqvist
  2011-04-15  8:23                 ` Jim Meyering
@ 2011-04-15 13:20                 ` Tom Tromey
  2011-04-15 17:52                   ` Jim Meyering
  1 sibling, 1 reply; 31+ messages in thread
From: Tom Tromey @ 2011-04-15 13:20 UTC (permalink / raw)
  To: Janne Blomqvist
  Cc: Jim Meyering, Joseph S. Myers, gcc-patches, java-patches,
	fortran, gcc mailing list

>>>>> "Janne" == Janne Blomqvist <blomqvist.janne@gmail.com> writes:

Jim> Can someone add me to the gcc group?  That would help.
Jim> I already have ssh access to sourceware.org.

Janne> I'm not sure if I'm considered to be well-established
Janne> enough, so could someone help Jim out here, please?

I added Jim to the gcc group.

Tom

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v3] Re: avoid useless if-before-free tests
  2011-04-15 13:20                 ` Tom Tromey
@ 2011-04-15 17:52                   ` Jim Meyering
  0 siblings, 0 replies; 31+ messages in thread
From: Jim Meyering @ 2011-04-15 17:52 UTC (permalink / raw)
  To: Tom Tromey
  Cc: Janne Blomqvist, Joseph S. Myers, gcc-patches, java-patches,
	fortran, gcc mailing list

> I added Jim to the gcc group.

Thanks, Tom.

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2011-04-15 17:52 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87zkp9zmq0.fsf@rho.meyering.net>
2011-03-05 19:16 ` avoid useless if-before-free tests Joseph S. Myers
2011-03-07 19:52   ` Dr Andrew John Hughes
2011-03-07 22:47     ` Joseph S. Myers
2011-03-08 16:57       ` Dr Andrew John Hughes
2011-03-08 17:07         ` Andrew Haley
2011-03-08 17:17         ` Jim Meyering
2011-03-08 10:45   ` Jim Meyering
2011-03-08 14:21   ` [PATCH v2] " Jim Meyering
2011-03-08 14:30     ` Rainer Orth
2011-03-08 15:28       ` Ian Lance Taylor
2011-03-08 15:36         ` Jakub Jelinek
2011-03-08 17:03       ` Jim Meyering
2011-03-08 18:45         ` Rainer Orth
2011-03-08 19:13           ` Jim Meyering
2011-03-08 19:20             ` Rainer Orth
2011-03-08 19:39               ` Jakub Jelinek
2011-03-08 17:54     ` [PATCH v3] " Jim Meyering
2011-03-08 19:34       ` DJ Delorie
2011-03-15  9:19       ` Janne Blomqvist
2011-03-15 10:03         ` [PATCH gcc/fortran] get rid of gfc_free Jim Meyering
2011-03-15 10:08           ` Jakub Jelinek
2011-03-15 10:27             ` Jim Meyering
2011-03-15 14:18           ` Janne Blomqvist
2011-03-15 18:21             ` Jim Meyering
2011-03-24 16:51         ` [PATCH v3] Re: avoid useless if-before-free tests Jim Meyering
2011-04-15  7:26           ` Janne Blomqvist
2011-04-15  7:54             ` Jim Meyering
2011-04-15  8:20               ` Janne Blomqvist
2011-04-15  8:23                 ` Jim Meyering
2011-04-15 13:20                 ` Tom Tromey
2011-04-15 17:52                   ` Jim Meyering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).