OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / libgfortran / generated / maxloc1_8_r8.c
index 858865a..c6f3efd 100644 (file)
@@ -1,8 +1,8 @@
 /* Implementation of the MAXLOC intrinsic
-   Copyright 2002, 2007, 2009 Free Software Foundation, Inc.
+   Copyright 2002, 2007, 2009, 2010 Free Software Foundation, Inc.
    Contributed by Paul Brook <paul@nowt.org>
 
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
 
 Libgfortran is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public
@@ -101,6 +101,7 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
       alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
                   * extent[rank-1];
 
+      retarray->data = internal_malloc_size (alloc_size);
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -108,8 +109,6 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
          return;
 
        }
-      else
-       retarray->data = internal_malloc_size (alloc_size);
     }
   else
     {
@@ -129,7 +128,7 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
       count[n] = 0;
       dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
       if (extent[n] <= 0)
-       len = 0;
+       return;
     }
 
   base = array->data;
@@ -174,6 +173,7 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
                    result = (GFC_INTEGER_8)n + 1;
                  }
              }
+           
            *dest = result;
          }
       }
@@ -439,7 +439,6 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
-  index_type sstride[GFC_MAX_DIMENSIONS];
   index_type dstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   index_type rank;
@@ -458,7 +457,6 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
 
   for (n = 0; n < dim; n++)
     {
-      sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n);
       extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
 
       if (extent[n] <= 0)
@@ -467,7 +465,6 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
 
   for (n = dim; n < rank; n++)
     {
-      sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1);
       extent[n] =
        GFC_DESCRIPTOR_EXTENT(array,n + 1);