diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index eded92ede0bca56fc0d6103dfbca2d40cccc2408..353ac9a02c4c5f39b99efab961171320669ff571 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,16 @@
+2005-05-12  Thomas Koenig  <Thomas.Koenig@online.de>
+
+	PR libfortran/21324
+	* runtime/memory.c:  Don't define GFC_CLEAR_MEMORY (it's a
+	performance hog).
+	* io/open.c (new_unit): Zero freshly allocated memory for
+	unit structure.
+	* io/unit.c (init_units):  Zero freshly allocated memory for
+	STDIN, STDOUT and STDERR.
+	* io/unix.c (open_internal):  Zero freshly allocated memory
+	for unix_stream.
+	(fd_to_stream):  Likewise.
+
 2005-05-11  Bud Davis  <bdavis@gfortran.org>
 
 	PR fortran/19478
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index 97bf6e4cc3d583e5f066a9e76829218990401a1c..f579f1f5b3c5b1cf838e880a5f6dc6762f1c284f 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -351,6 +351,7 @@ new_unit (unit_flags * flags)
   /* Create the unit structure.  */
 
   u = get_mem (sizeof (gfc_unit) + ioparm.file_len);
+  memset (u, '\0', sizeof (gfc_unit) + ioparm.file_len);
 
   u->unit_number = ioparm.unit;
   u->s = s;
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index ae0771f0816027b6d2c5ddbbe230309d5b8fd233..f0d8dbe205fded29212d2a3c557cedf1bf911f98 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -295,6 +295,7 @@ init_units (void)
   if (options.stdin_unit >= 0)
     {				/* STDIN */
       u = get_mem (sizeof (gfc_unit));
+      memset (u, '\0', sizeof (gfc_unit));
 
       u->unit_number = options.stdin_unit;
       u->s = input_stream ();
@@ -316,6 +317,7 @@ init_units (void)
   if (options.stdout_unit >= 0)
     {				/* STDOUT */
       u = get_mem (sizeof (gfc_unit));
+      memset (u, '\0', sizeof (gfc_unit));
 
       u->unit_number = options.stdout_unit;
       u->s = output_stream ();
@@ -337,6 +339,7 @@ init_units (void)
   if (options.stderr_unit >= 0)
     {				/* STDERR */
       u = get_mem (sizeof (gfc_unit));
+      memset (u, '\0', sizeof (gfc_unit));
 
       u->unit_number = options.stderr_unit;
       u->s = error_stream ();
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 92eea53ee5b03d6fd7daba20c598005a121131e7..2d8286ce04797ae5f77af8fe55c46e4595629764 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -872,6 +872,7 @@ open_internal (char *base, int length)
   unix_stream *s;
 
   s = get_mem (sizeof (unix_stream));
+  memset (s, '\0', sizeof (unix_stream));
 
   s->buffer = base;
   s->buffer_offset = 0;
@@ -900,6 +901,7 @@ fd_to_stream (int fd, int prot, int avoid_mmap)
   unix_stream *s;
 
   s = get_mem (sizeof (unix_stream));
+  memset (s, '\0', sizeof (unix_stream));
 
   s->fd = fd;
   s->buffer_offset = 0;
diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c
index 8b8dca89afde2190b564e7a3631e4f27cf12c26d..ce2dc91c7974cdbd3e29f87fa73bd945bbd7b6d5 100644
--- a/libgfortran/runtime/memory.c
+++ b/libgfortran/runtime/memory.c
@@ -36,7 +36,7 @@ Boston, MA 02111-1307, USA.  */
    return memory that is guaranteed to be set to zero.  This can have
    a severe efficiency penalty, so it should never be set if good
    performance is desired, but it can help when you're debugging code.  */
-#define GFC_CLEAR_MEMORY
+/* #define GFC_CLEAR_MEMORY */
 
 /* If GFC_CHECK_MEMORY is defined, we do some sanity checks at runtime.
    This causes small overhead, but again, it also helps debugging.  */