summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2019-01-07 19:30:28 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2019-01-07 19:30:28 +0000
commit419af57c134f3b068530ea51179c220e52623067 (patch)
tree13b595e197309edb81f16d4d5476a620191f51b9 /libgfortran
parent25a34b0236ffcf23e9bc29826475729ccfef7c38 (diff)
downloadgcc-419af57c134f3b068530ea51179c220e52623067.tar.gz
re PR fortran/45424 ([F08] Add IS_CONTIGUOUS intrinsic)
2019-01-07 Thomas Koenig <tkoenig@gcc.gnu.org> Harald Anlauf <anlauf@gmx.de> Tobias Burnus <burnus@gcc.gnu.org> PR fortran/45424 * check.c (gfc_check_is_contiguous): New function. * expr.c (gfc_is_not_contiguous): New function. * gfortran.h (gfc_isym_id): Add GFC_ISYM_IS_CONTIGUOUS. Add prototype for gfc_is_not_contiguous. * intrinsic.c (do_ts29113_check): Add GFC_ISYM_IS_CONTIGUOUS. (add_function): Add is_contiguous. * intrinsic.h: Add prototypes for gfc_check_is_contiguous, gfc_simplify_is_contiguous and gfc_resolve_is_contiguous. * intrinsic.texi: Add IS_CONTIGUOUS. * iresolve.c (gfc_resolve_is_contiguous): New function. * simplify.c (gfc_simplify_is_contiguous): New function. * trans-decl.c (gfor_fncecl_is_contiguous0): New variable. (gfc_build_intrinsic_function_decl): Add it. * trans-intrinsic.c (gfc_conv_intrinsic_is_contiguous): New function. (gfc_conv_intrinsic_function): Handle GFC_ISYM_IS_CONTIGUOUS. 2019-01-07 Thomas Koenig <tkoenig@gcc.gnu.org> Harald Anlauf <anlauf@gmx.de> Tobias Burnus <burnus@gcc.gnu.org> PR fortran/45424 * Makefile.am: Add intrinsics/is_contiguous.c. * Makefile.in: Regenerated. * gfortran.map: Add _gfortran_is_contiguous0. * intrinsics/is_contiguous.c: New file. * libgfortran.h: Add prototype for is_contiguous0. 2019-01-07 Thomas Koenig <tkoenig@gcc.gnu.org> Harald Anlauf <anlauf@gmx.de> Tobias Burnus <burnus@gcc.gnu.org> * gfortran.dg/is_contiguous_1.f90: New test. * gfortran.dg/is_contiguous_2.f90: New test. * gfortran.dg/is_contiguous_3.f90: New test. Co-Authored-By: Harald Anlauf <anlauf@gmx.de> Co-Authored-By: Tobias Burnus <burnus@gcc.gnu.org> From-SVN: r267657
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog11
-rw-r--r--libgfortran/Makefile.am1
-rw-r--r--libgfortran/Makefile.in11
-rw-r--r--libgfortran/gfortran.map1
-rw-r--r--libgfortran/intrinsics/is_contiguous.c49
-rw-r--r--libgfortran/libgfortran.h5
6 files changed, 77 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 52d8d1e317d..eee978f654b 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,14 @@
+2019-01-07 Thomas Koenig <tkoenig@gcc.gnu.org>
+ Harald Anlauf <anlauf@gmx.de>
+ Tobias Burnus <burnus@gcc.gnu.org>
+
+ PR fortran/45424
+ * Makefile.am: Add intrinsics/is_contiguous.c.
+ * Makefile.in: Regenerated.
+ * gfortran.map: Add _gfortran_is_contiguous0.
+ * intrinsics/is_contiguous.c: New file.
+ * libgfortran.h: Add prototype for is_contiguous0.
+
2019-01-07 Janne Blomqvist <jb@gcc.gnu.org>
* gfortran.map (GFORTRAN_9): Make GFORTRAN_9 node depend on
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 87000c6e60c..e1d757d9b91 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -124,6 +124,7 @@ intrinsics/extends_type_of.c \
intrinsics/fnum.c \
intrinsics/ierrno.c \
intrinsics/ishftc.c \
+intrinsics/is_contiguous.c \
intrinsics/mvbits.c \
intrinsics/move_alloc.c \
intrinsics/pack_generic.c \
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index 2424f7e6ba8..ed8cf4cf9c9 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -414,7 +414,7 @@ am__objects_54 = size_from_kind.lo $(am__objects_53)
am__objects_57 = associated.lo abort.lo args.lo cshift0.lo eoshift0.lo \
eoshift2.lo erfc_scaled.lo extends_type_of.lo fnum.lo \
ierrno.lo ishftc.lo mvbits.lo move_alloc.lo pack_generic.lo \
- selected_char_kind.lo size.lo spread_generic.lo \
+ selected_char_kind.lo size.lo is_contiguous.lo spread_generic.lo \
string_intrinsics.lo rand.lo random.lo reshape_generic.lo \
reshape_packed.lo selected_int_kind.lo selected_real_kind.lo \
unpack_generic.lo in_pack_generic.lo in_unpack_generic.lo \
@@ -760,6 +760,7 @@ gfor_helper_src = intrinsics/associated.c intrinsics/abort.c \
intrinsics/ierrno.c intrinsics/ishftc.c intrinsics/mvbits.c \
intrinsics/move_alloc.c intrinsics/pack_generic.c \
intrinsics/selected_char_kind.c intrinsics/size.c \
+ intrinsics/is_contiguous.c \
intrinsics/spread_generic.c intrinsics/string_intrinsics.c \
intrinsics/rand.c intrinsics/random.c \
intrinsics/reshape_generic.c intrinsics/reshape_packed.c \
@@ -2198,6 +2199,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/single.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/size.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/size_from_kind.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is_contiguous.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sleep.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spread_c10.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spread_c16.Plo@am__quote@
@@ -6318,6 +6320,13 @@ size.lo: intrinsics/size.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o size.lo `test -f 'intrinsics/size.c' || echo '$(srcdir)/'`intrinsics/size.c
+is_contiguous.lo: intrinsics/is_contiguous.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT is_contiguous.lo -MD -MP -MF $(DEPDIR)/is_contiguous.Tpo -c -o is_contiguous.lo `test -f 'intrinsics/is_contiguous.c' || echo '$(srcdir)/'`intrinsics/is_contiguous.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/is_contiguous.Tpo $(DEPDIR)/is_contiguous.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='intrinsics/is_contiguous.c' object='is_contiguous.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o is_contiguous.lo `test -f 'intrinsics/is_contiguous.c' || echo '$(srcdir)/'`intrinsics/is_contiguous.c
+
spread_generic.lo: intrinsics/spread_generic.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spread_generic.lo -MD -MP -MF $(DEPDIR)/spread_generic.Tpo -c -o spread_generic.lo `test -f 'intrinsics/spread_generic.c' || echo '$(srcdir)/'`intrinsics/spread_generic.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spread_generic.Tpo $(DEPDIR)/spread_generic.Plo
diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map
index 681f7dd6125..43b32de5bf7 100644
--- a/libgfortran/gfortran.map
+++ b/libgfortran/gfortran.map
@@ -1518,6 +1518,7 @@ GFORTRAN_9 {
_gfortran_findloc1_s4;
_gfortran_findloc2_s1;
_gfortran_findloc2_s4;
+ _gfortran_is_contiguous0;
_gfortran_mfindloc0_c16;
_gfortran_mfindloc0_c4;
_gfortran_mfindloc0_c8;
diff --git a/libgfortran/intrinsics/is_contiguous.c b/libgfortran/intrinsics/is_contiguous.c
new file mode 100644
index 00000000000..eea63a04462
--- /dev/null
+++ b/libgfortran/intrinsics/is_contiguous.c
@@ -0,0 +1,49 @@
+/* Implementation of the is_contiguous intrinsic.
+ Copyright (C) 2019 Free Software Foundation, Inc.
+ Contributed by Thomas König <tkoenig@gcc.gnu.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
+<https://www.gnu.org/licenses/>. */
+
+#include "libgfortran.h"
+
+GFC_LOGICAL_4
+is_contiguous0 (const array_t * const restrict array)
+{
+ index_type dim;
+ index_type n;
+ index_type extent, stride;
+
+ dim = GFC_DESCRIPTOR_RANK (array);
+
+ extent = 1;
+ for (n = 0; n < dim; n++)
+ {
+ stride = GFC_DESCRIPTOR_STRIDE (array, n);
+ if (stride != extent)
+ return 0;
+
+ extent *= GFC_DESCRIPTOR_EXTENT (array, n);
+ }
+
+ return 1;
+}
+iexport(is_contiguous0);
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index 6b4775a1365..433b204abda 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -1375,6 +1375,11 @@ typedef GFC_ARRAY_DESCRIPTOR (void) array_t;
extern index_type size0 (const array_t * array);
iexport_proto(size0);
+/* is_contiguous.c */
+
+extern GFC_LOGICAL_4 is_contiguous0 (const array_t * const restrict array);
+iexport_proto(is_contiguous0);
+
/* bounds.c */
extern void bounds_equal_extents (array_t *, array_t *, const char *,