OSDN Git Service

2009-07-19 Thomas Koenig <tkoenig@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / libgfortran / intrinsics / eoshift2.c
index aa5ef5a..2fbf62e 100644 (file)
@@ -75,7 +75,6 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
     {
       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++)
@@ -92,15 +91,20 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
 
          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);
+
         }
     }
-  else
+  else if (unlikely (compile_options.bounds_check))
     {
-      if (size0 ((array_t *) ret) == 0)
-       return;
+      bounds_equal_extents ((array_t *) ret, (array_t *) array,
+                                "return value", "EOSHIFT");
     }
 
-  if (arraysize == 0 && filler == NULL)
+  if (arraysize == 0)
     return;
 
   which = which - 1;