aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2015-08-26 12:37:42 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2015-08-26 12:37:42 +0000
commited019753cb56d0f1b770bcb386e840c9785949d5 (patch)
treef1c84026400bff374b6122e5c8ae844e7d2a18ad
parent485adf79b5e5fa8808fdca1dbc2e818902dfa081 (diff)
downloadgcc-ed019753cb56d0f1b770bcb386e840c9785949d5.zip
gcc-ed019753cb56d0f1b770bcb386e840c9785949d5.tar.gz
gcc-ed019753cb56d0f1b770bcb386e840c9785949d5.tar.bz2
re PR fortran/29600 ([F03] MINLOC and MAXLOC take an optional KIND argument)
PR fortran/29600 * Makefile.am: Add generated/shape_i{1,2}.c * Makefile.in: Regenerate. * generated/shape_i1.c: New generated file. * generated/shape_i2.c: New generated file. * generated/shape_i4.c: Regenerate. * generated/shape_i8.c: Regenerate. * generated/shape_i16.c: Regenerate. * gfortran.map (GFORTRAN_1.7): Add _gfortran_shape_{1,2}. * m4/shape.m4: Fix parameter type. * gfortran.dg/shape_8.f90: New test. From-SVN: r227210
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/shape_8.f9015
-rw-r--r--libgfortran/ChangeLog13
-rw-r--r--libgfortran/Makefile.am2
-rw-r--r--libgfortran/Makefile.in21
-rw-r--r--libgfortran/generated/shape_i1.c67
-rw-r--r--libgfortran/generated/shape_i16.c4
-rw-r--r--libgfortran/generated/shape_i2.c67
-rw-r--r--libgfortran/generated/shape_i4.c4
-rw-r--r--libgfortran/generated/shape_i8.c4
-rw-r--r--libgfortran/gfortran.map2
-rw-r--r--libgfortran/m4/shape.m44
12 files changed, 199 insertions, 9 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e8365be..ac54988 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-26 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/29600
+ * gfortran.dg/shape_8.f90: New test.
+
2015-08-25 Marek Polacek <polacek@redhat.com>
PR middle-end/67330
diff --git a/gcc/testsuite/gfortran.dg/shape_8.f90 b/gcc/testsuite/gfortran.dg/shape_8.f90
new file mode 100644
index 0000000..51c6e55
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/shape_8.f90
@@ -0,0 +1,15 @@
+! { dg-do run }
+!
+! Check that we can use SHAPE with optional kind argument
+!
+program test
+ implicit none
+ real, allocatable :: x(:,:)
+
+ allocate(x(2,5))
+ if (any(shape(x) /= [ 2, 5 ])) call abort
+ if (any(shape(x,kind=1) /= [ 2, 5 ])) call abort
+ if (any(shape(x,kind=2) /= [ 2, 5 ])) call abort
+ if (any(shape(x,kind=4) /= [ 2, 5 ])) call abort
+ if (any(shape(x,kind=8) /= [ 2, 5 ])) call abort
+end
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index e3ab51f..65e0099 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,5 +1,18 @@
2015-08-26 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+ PR fortran/29600
+ * Makefile.am: Add generated/shape_i{1,2}.c
+ * Makefile.in: Regenerate.
+ * generated/shape_i1.c: New generated file.
+ * generated/shape_i2.c: New generated file.
+ * generated/shape_i4.c: Regenerate.
+ * generated/shape_i8.c: Regenerate.
+ * generated/shape_i16.c: Regenerate.
+ * gfortran.map (GFORTRAN_1.7): Add _gfortran_shape_{1,2}.
+ * m4/shape.m4: Fix parameter type.
+
+2015-08-26 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
* libgfortran.h (show_variables): Remove prototype.
* runtime/environ.c (print_spaces, var_source, show_integer,
show_boolean, show_sep, show_string): Remove functions.
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index e476433..39d3e11 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -483,6 +483,8 @@ $(srcdir)/generated/transpose_c10.c \
$(srcdir)/generated/transpose_c16.c
i_shape_c= \
+$(srcdir)/generated/shape_i1.c \
+$(srcdir)/generated/shape_i2.c \
$(srcdir)/generated/shape_i4.c \
$(srcdir)/generated/shape_i8.c \
$(srcdir)/generated/shape_i16.c
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index f0ddb38..7ed080c 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -259,7 +259,8 @@ am__objects_23 = transpose_i4.lo transpose_i8.lo transpose_i16.lo \
transpose_r4.lo transpose_r8.lo transpose_r10.lo \
transpose_r16.lo transpose_c4.lo transpose_c8.lo \
transpose_c10.lo transpose_c16.lo
-am__objects_24 = shape_i4.lo shape_i8.lo shape_i16.lo
+am__objects_24 = shape_i1.lo shape_i2.lo shape_i4.lo shape_i8.lo \
+ shape_i16.lo
am__objects_25 = eoshift1_4.lo eoshift1_8.lo eoshift1_16.lo
am__objects_26 = eoshift3_4.lo eoshift3_8.lo eoshift3_16.lo
am__objects_27 = cshift1_4.lo cshift1_8.lo cshift1_16.lo
@@ -916,6 +917,8 @@ $(srcdir)/generated/transpose_c10.c \
$(srcdir)/generated/transpose_c16.c
i_shape_c = \
+$(srcdir)/generated/shape_i1.c \
+$(srcdir)/generated/shape_i2.c \
$(srcdir)/generated/shape_i4.c \
$(srcdir)/generated/shape_i8.c \
$(srcdir)/generated/shape_i16.c
@@ -1826,7 +1829,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_exponent_r16.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_exponent_r4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_exponent_r8.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_i1.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_i16.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_i2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_i4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_i8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal.Plo@am__quote@
@@ -4016,6 +4021,20 @@ transpose_c16.lo: $(srcdir)/generated/transpose_c16.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o transpose_c16.lo `test -f '$(srcdir)/generated/transpose_c16.c' || echo '$(srcdir)/'`$(srcdir)/generated/transpose_c16.c
+shape_i1.lo: $(srcdir)/generated/shape_i1.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT shape_i1.lo -MD -MP -MF $(DEPDIR)/shape_i1.Tpo -c -o shape_i1.lo `test -f '$(srcdir)/generated/shape_i1.c' || echo '$(srcdir)/'`$(srcdir)/generated/shape_i1.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/shape_i1.Tpo $(DEPDIR)/shape_i1.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/shape_i1.c' object='shape_i1.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o shape_i1.lo `test -f '$(srcdir)/generated/shape_i1.c' || echo '$(srcdir)/'`$(srcdir)/generated/shape_i1.c
+
+shape_i2.lo: $(srcdir)/generated/shape_i2.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT shape_i2.lo -MD -MP -MF $(DEPDIR)/shape_i2.Tpo -c -o shape_i2.lo `test -f '$(srcdir)/generated/shape_i2.c' || echo '$(srcdir)/'`$(srcdir)/generated/shape_i2.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/shape_i2.Tpo $(DEPDIR)/shape_i2.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/shape_i2.c' object='shape_i2.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o shape_i2.lo `test -f '$(srcdir)/generated/shape_i2.c' || echo '$(srcdir)/'`$(srcdir)/generated/shape_i2.c
+
shape_i4.lo: $(srcdir)/generated/shape_i4.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT shape_i4.lo -MD -MP -MF $(DEPDIR)/shape_i4.Tpo -c -o shape_i4.lo `test -f '$(srcdir)/generated/shape_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/shape_i4.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/shape_i4.Tpo $(DEPDIR)/shape_i4.Plo
diff --git a/libgfortran/generated/shape_i1.c b/libgfortran/generated/shape_i1.c
new file mode 100644
index 0000000..6ac8e14
--- /dev/null
+++ b/libgfortran/generated/shape_i1.c
@@ -0,0 +1,67 @@
+/* Implementation of the SHAPE intrinsic
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
+ Contributed by Paul Brook <paul@nowt.org>
+
+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
+License as published by the Free Software Foundation; either
+version 3 of the License, or (at your option) any later version.
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+
+
+#if defined (HAVE_GFC_INTEGER_1)
+
+extern void shape_1 (gfc_array_i1 * const restrict ret,
+ const array_t * const restrict array);
+export_proto(shape_1);
+
+void
+shape_1 (gfc_array_i1 * const restrict ret,
+ const array_t * const restrict array)
+{
+ int n;
+ index_type stride;
+ index_type extent;
+ int rank;
+
+ rank = GFC_DESCRIPTOR_RANK (array);
+
+ if (ret->base_addr == NULL)
+ {
+ GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
+ ret->offset = 0;
+ ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_1));
+ }
+
+ stride = GFC_DESCRIPTOR_STRIDE(ret,0);
+
+ if (GFC_DESCRIPTOR_EXTENT(ret,0) < 1)
+ return;
+
+ for (n = 0; n < rank; n++)
+ {
+ extent = GFC_DESCRIPTOR_EXTENT(array,n);
+ ret->base_addr[n * stride] = extent > 0 ? extent : 0 ;
+ }
+}
+
+#endif
diff --git a/libgfortran/generated/shape_i16.c b/libgfortran/generated/shape_i16.c
index a9cb8a2..4cb43c8 100644
--- a/libgfortran/generated/shape_i16.c
+++ b/libgfortran/generated/shape_i16.c
@@ -31,12 +31,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_INTEGER_16)
extern void shape_16 (gfc_array_i16 * const restrict ret,
- const gfc_array_i16 * const restrict array);
+ const array_t * const restrict array);
export_proto(shape_16);
void
shape_16 (gfc_array_i16 * const restrict ret,
- const gfc_array_i16 * const restrict array)
+ const array_t * const restrict array)
{
int n;
index_type stride;
diff --git a/libgfortran/generated/shape_i2.c b/libgfortran/generated/shape_i2.c
new file mode 100644
index 0000000..982d9cc
--- /dev/null
+++ b/libgfortran/generated/shape_i2.c
@@ -0,0 +1,67 @@
+/* Implementation of the SHAPE intrinsic
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
+ Contributed by Paul Brook <paul@nowt.org>
+
+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
+License as published by the Free Software Foundation; either
+version 3 of the License, or (at your option) any later version.
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "libgfortran.h"
+#include <stdlib.h>
+#include <assert.h>
+
+
+#if defined (HAVE_GFC_INTEGER_2)
+
+extern void shape_2 (gfc_array_i2 * const restrict ret,
+ const array_t * const restrict array);
+export_proto(shape_2);
+
+void
+shape_2 (gfc_array_i2 * const restrict ret,
+ const array_t * const restrict array)
+{
+ int n;
+ index_type stride;
+ index_type extent;
+ int rank;
+
+ rank = GFC_DESCRIPTOR_RANK (array);
+
+ if (ret->base_addr == NULL)
+ {
+ GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
+ ret->offset = 0;
+ ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_2));
+ }
+
+ stride = GFC_DESCRIPTOR_STRIDE(ret,0);
+
+ if (GFC_DESCRIPTOR_EXTENT(ret,0) < 1)
+ return;
+
+ for (n = 0; n < rank; n++)
+ {
+ extent = GFC_DESCRIPTOR_EXTENT(array,n);
+ ret->base_addr[n * stride] = extent > 0 ? extent : 0 ;
+ }
+}
+
+#endif
diff --git a/libgfortran/generated/shape_i4.c b/libgfortran/generated/shape_i4.c
index 04654ea..8a912b3 100644
--- a/libgfortran/generated/shape_i4.c
+++ b/libgfortran/generated/shape_i4.c
@@ -31,12 +31,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_INTEGER_4)
extern void shape_4 (gfc_array_i4 * const restrict ret,
- const gfc_array_i4 * const restrict array);
+ const array_t * const restrict array);
export_proto(shape_4);
void
shape_4 (gfc_array_i4 * const restrict ret,
- const gfc_array_i4 * const restrict array)
+ const array_t * const restrict array)
{
int n;
index_type stride;
diff --git a/libgfortran/generated/shape_i8.c b/libgfortran/generated/shape_i8.c
index 7b09888..d33add6 100644
--- a/libgfortran/generated/shape_i8.c
+++ b/libgfortran/generated/shape_i8.c
@@ -31,12 +31,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_INTEGER_8)
extern void shape_8 (gfc_array_i8 * const restrict ret,
- const gfc_array_i8 * const restrict array);
+ const array_t * const restrict array);
export_proto(shape_8);
void
shape_8 (gfc_array_i8 * const restrict ret,
- const gfc_array_i8 * const restrict array)
+ const array_t * const restrict array)
{
int n;
index_type stride;
diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map
index 6684063..5f011de 100644
--- a/libgfortran/gfortran.map
+++ b/libgfortran/gfortran.map
@@ -1285,6 +1285,8 @@ GFORTRAN_1.7 {
__ieee_exceptions_MOD_ieee_support_flag_10;
__ieee_exceptions_MOD_ieee_support_flag_16;
_gfortran_mvbits_i16;
+ _gfortran_shape_1;
+ _gfortran_shape_2;
} GFORTRAN_1.6;
F2C_1.0 {
diff --git a/libgfortran/m4/shape.m4 b/libgfortran/m4/shape.m4
index ffdcebe..e389d92 100644
--- a/libgfortran/m4/shape.m4
+++ b/libgfortran/m4/shape.m4
@@ -32,12 +32,12 @@ include(iparm.m4)dnl
`#if defined (HAVE_'rtype_name`)
extern void shape_'rtype_kind` ('rtype` * const restrict ret,
- const 'rtype` * const restrict array);
+ const array_t * const restrict array);
export_proto(shape_'rtype_kind`);
void
shape_'rtype_kind` ('rtype` * const restrict ret,
- const 'rtype` * const restrict array)
+ const array_t * const restrict array)
{
int n;
index_type stride;