Index: runtime/memory.c
===================================================================
--- runtime/memory.c	(Revision 175598)
+++ runtime/memory.c	(Arbeitskopie)
@@ -54,8 +54,8 @@ get_mem (size_t n)
 void *
 internal_malloc_size (size_t size)
 {
-  if (size == 0)
-    return NULL;
+  if (unlikely (size <= 0))
+    size = 1;
 
   return get_mem (size);
 }
Index: m4/pack.m4
===================================================================
--- m4/pack.m4	(Revision 175598)
+++ m4/pack.m4	(Arbeitskopie)
@@ -167,14 +167,12 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *ar
 	  GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
 
 	  ret->offset = 0;
+
+	  /* internal_malloc_size allocates a single byte for zero size.  */
+	  ret->data = internal_malloc_size (sizeof ('rtype_name`) * total);
+
 	  if (total == 0)
-	    {
-	      /* In this case, nothing remains to be done.  */
-	      ret->data = internal_malloc_size (1);
-	      return;
-	    }
-	  else
-	    ret->data = internal_malloc_size (sizeof ('rtype_name`) * total);
+	    return;
 	}
       else 
 	{
Index: m4/spread.m4
===================================================================
--- m4/spread.m4	(Revision 175598)
+++ m4/spread.m4	(Arbeitskopie)
@@ -101,13 +101,11 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *
 	  GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
 	}
       ret->offset = 0;
-      if (rs > 0)
-        ret->data = internal_malloc_size (rs * sizeof('rtype_name`));
-      else
-	{
-	  ret->data = internal_malloc_size (1);
-	  return;
-	}
+
+      /* internal_malloc_size allocates a single byte for zero size.  */
+      ret->data = internal_malloc_size (rs * sizeof('rtype_name`));
+      if (rs <= 0)
+        return;
     }
   else
     {
Index: m4/eoshift1.m4
===================================================================
--- m4/eoshift1.m4	(Revision 175598)
+++ m4/eoshift1.m4	(Arbeitskopie)
@@ -89,7 +89,6 @@ eoshift1 (gfc_array_char * const restrict ret,
     {
       int i;
 
-      ret->data = internal_malloc_size (size * arraysize);
       ret->offset = 0;
       ret->dtype = array->dtype;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -107,10 +106,8 @@ eoshift1 (gfc_array_char * const restrict ret,
 	  GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
         }
-      if (arraysize > 0)
-	ret->data = internal_malloc_size (size * arraysize);
-      else
-	ret->data = internal_malloc_size (1);
+      /* internal_malloc_size allocates a single byte for zero size.  */
+      ret->data = internal_malloc_size (size * arraysize);
 
     }
   else if (unlikely (compile_options.bounds_check))
Index: m4/eoshift3.m4
===================================================================
--- m4/eoshift3.m4	(Revision 175598)
+++ m4/eoshift3.m4	(Arbeitskopie)
@@ -108,10 +108,8 @@ eoshift3 (gfc_array_char * const restrict ret,
 	  GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
         }
-      if (arraysize > 0)
-	ret->data = internal_malloc_size (size * arraysize);
-      else
-	ret->data = internal_malloc_size (1);
+      /* internal_malloc_size allocates a single byte for zero size.  */
+      ret->data = internal_malloc_size (size * arraysize);
 
     }
   else if (unlikely (compile_options.bounds_check))
Index: intrinsics/pack_generic.c
===================================================================
--- intrinsics/pack_generic.c	(Revision 175598)
+++ intrinsics/pack_generic.c	(Arbeitskopie)
@@ -153,14 +153,11 @@ pack_internal (gfc_array_char *ret, const gfc_arra
 	  GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
 
 	  ret->offset = 0;
+	  /* internal_malloc_size allocates a single byte for zero size.  */
+	  ret->data = internal_malloc_size (size * total);
+
 	  if (total == 0)
-	    {
-	      /* In this case, nothing remains to be done.  */
-	      ret->data = internal_malloc_size (1);
-	      return;
-	    }
-	  else
-	    ret->data = internal_malloc_size (size * total);
+	    return;      /* In this case, nothing remains to be done.  */
 	}
       else 
 	{
@@ -523,13 +520,10 @@ pack_s_internal (gfc_array_char *ret, const gfc_ar
 
       ret->offset = 0;
 
+      ret->data = internal_malloc_size (size * total);
+
       if (total == 0)
-	{
-	  ret->data = internal_malloc_size (1);
-	  return;
-	}
-      else
-	ret->data = internal_malloc_size (size * total);
+	return;
     }
 
   rstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(ret,0);
Index: intrinsics/cshift0.c
===================================================================
--- intrinsics/cshift0.c	(Revision 175598)
+++ intrinsics/cshift0.c	(Arbeitskopie)
@@ -79,10 +79,8 @@ cshift0 (gfc_array_char * ret, const gfc_array_cha
 	  GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
         }
 
-      if (arraysize > 0)
-	ret->data = internal_malloc_size (size * arraysize);
-      else
-	ret->data = internal_malloc_size (1);
+      /* internal_malloc_size allocates a single byte for zero size.  */
+      ret->data = internal_malloc_size (size * arraysize);
     }
   else if (unlikely (compile_options.bounds_check))
     {
Index: intrinsics/spread_generic.c
===================================================================
--- intrinsics/spread_generic.c	(Revision 175598)
+++ intrinsics/spread_generic.c	(Arbeitskopie)
@@ -100,13 +100,10 @@ spread_internal (gfc_array_char *ret, const gfc_ar
 	  GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
 	}
       ret->offset = 0;
-      if (rs > 0)
-        ret->data = internal_malloc_size (rs * size);
-      else
-	{
-	  ret->data = internal_malloc_size (1);
-	  return;
-	}
+      ret->data = internal_malloc_size (rs * size);
+
+      if (rs <= 0)
+	return;
     }
   else
     {
Index: intrinsics/eoshift0.c
===================================================================
--- intrinsics/eoshift0.c	(Revision 175598)
+++ intrinsics/eoshift0.c	(Arbeitskopie)
@@ -86,11 +86,8 @@ eoshift0 (gfc_array_char * ret, const gfc_array_ch
 
         }
 
-      if (arraysize > 0)
-	ret->data = internal_malloc_size (size * arraysize);
-      else
-	ret->data = internal_malloc_size (1);
-
+      /* internal_malloc_size allocates a single byte for zero size.  */
+      ret->data = internal_malloc_size (size * arraysize);
     }
   else if (unlikely (compile_options.bounds_check))
     {
Index: intrinsics/eoshift2.c
===================================================================
--- intrinsics/eoshift2.c	(Revision 175598)
+++ intrinsics/eoshift2.c	(Arbeitskopie)
@@ -91,10 +91,8 @@ eoshift2 (gfc_array_char *ret, const gfc_array_cha
 
 	  GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
-	  if (arraysize > 0)
-	    ret->data = internal_malloc_size (size * arraysize);
-	  else
-	    ret->data = internal_malloc_size (1);
+          /* internal_malloc_size allocates a single byte for zero size.  */
+	  ret->data = internal_malloc_size (size * arraysize);
 
         }
     }
