sse4_1-roundps-1.c: Remove ASM_SUFFIX define.
[gcc.git] / libgfortran / generated / eoshift1_8.c
index f8922b344a5c546b92092b9f624ece34d1bb9da1..fff683c357e6f8061e3620ebd5cb79425e895aa4 100644 (file)
@@ -1,8 +1,8 @@
 /* Implementation of the EOSHIFT intrinsic
-   Copyright 2002, 2005, 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2002-2015 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
@@ -62,6 +62,7 @@ eoshift1 (gfc_array_char * const restrict ret,
   index_type len;
   index_type n;
   index_type size;
+  index_type arraysize;
   int which;
   GFC_INTEGER_8 sh;
   GFC_INTEGER_8 delta;
@@ -82,11 +83,11 @@ eoshift1 (gfc_array_char * const restrict ret,
   extent[0] = 1;
   count[0] = 0;
 
-  if (ret->data == NULL)
+  arraysize = size0 ((array_t *) array);
+  if (ret->base_addr == NULL)
     {
       int i;
 
-      ret->data = internal_malloc_size (size * size0 ((array_t *)array));
       ret->offset = 0;
       ret->dtype = array->dtype;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -104,13 +105,25 @@ eoshift1 (gfc_array_char * const restrict ret,
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
         }
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (arraysize, size);
+
     }
-  else
+  else if (unlikely (compile_options.bounds_check))
+    {
+      bounds_equal_extents ((array_t *) ret, (array_t *) array,
+                                "return value", "EOSHIFT");
+    }
+
+  if (unlikely (compile_options.bounds_check))
     {
-      if (size0 ((array_t *) ret) == 0)
-       return;
+      bounds_reduced_extents ((array_t *) h, (array_t *) array, which,
+                             "SHIFT argument", "EOSHIFT");
     }
 
+  if (arraysize == 0)
+    return;
+
   n = 0;
   for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
     {
@@ -146,9 +159,9 @@ eoshift1 (gfc_array_char * const restrict ret,
   rstride0 = rstride[0];
   sstride0 = sstride[0];
   hstride0 = hstride[0];
-  rptr = ret->data;
-  sptr = array->data;
-  hptr = h->data;
+  rptr = ret->base_addr;
+  sptr = array->base_addr;
+  hptr = h->base_addr;
 
   while (rptr)
     {