OSDN Git Service

2008-01-27 Thomas Koenig <tkoenig@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / libgfortran / generated / shape_i16.c
index 87a58ff..77274d6 100644 (file)
@@ -1,5 +1,5 @@
 /* Implementation of the SHAPE intrinsic
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2006, 2007 Free Software Foundation, Inc.
    Contributed by Paul Brook <paul@nowt.org>
 
 This file is part of the GNU Fortran 95 runtime library (libgfortran).
@@ -28,25 +28,28 @@ License along with libgfortran; see the file COPYING.  If not,
 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
-#include "config.h"
+#include "libgfortran.h"
 #include <stdlib.h>
 #include <assert.h>
-#include "libgfortran.h"
+
 
 #if defined (HAVE_GFC_INTEGER_16)
 
-extern void shape_16 (gfc_array_i16 * ret, const gfc_array_i16 * array);
+extern void shape_16 (gfc_array_i16 * const restrict ret, 
+       const gfc_array_i16 * const restrict array);
 export_proto(shape_16);
 
 void
-shape_16 (gfc_array_i16 * ret, const gfc_array_i16 * array)
+shape_16 (gfc_array_i16 * const restrict ret, 
+       const gfc_array_i16 * const restrict array)
 {
   int n;
   index_type stride;
 
   stride = ret->dim[0].stride;
-  if (stride == 0)
-    stride = 1;
+
+  if (ret->dim[0].ubound < ret->dim[0].lbound)
+    return;
 
   for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++)
     {