OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / libgfortran / generated / product_c16.c
index 9df23f3..d595102 100644 (file)
@@ -1,8 +1,8 @@
 /* Implementation of the PRODUCT 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
@@ -100,6 +100,7 @@ product_c16 (gfc_array_c16 * const restrict retarray,
       alloc_size = sizeof (GFC_COMPLEX_16) * 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.  */
@@ -107,8 +108,6 @@ product_c16 (gfc_array_c16 * const restrict retarray,
          return;
 
        }
-      else
-       retarray->data = internal_malloc_size (alloc_size);
     }
   else
     {
@@ -128,7 +127,7 @@ product_c16 (gfc_array_c16 * const restrict retarray,
       count[n] = 0;
       dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
       if (extent[n] <= 0)
-       len = 0;
+       return;
     }
 
   base = array->data;
@@ -152,6 +151,7 @@ product_c16 (gfc_array_c16 * const restrict retarray,
 
   result *= *src;
              }
+           
            *dest = result;
          }
       }
@@ -384,7 +384,6 @@ sproduct_c16 (gfc_array_c16 * 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_COMPLEX_16 * restrict dest;
   index_type rank;
@@ -403,7 +402,6 @@ sproduct_c16 (gfc_array_c16 * 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)
@@ -412,7 +410,6 @@ sproduct_c16 (gfc_array_c16 * 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);