[patch, fortran] Implement IS_CONTINUOUS intrinsic

Thomas Koenig tkoenig@netcologne.de
Sun Jan 6 22:04:00 GMT 2019


Hello world,

the attached patch builds on a long history:  Tobias Burnus created
an original version in 2012. Harald Anlauf recently picked it up,
(see https://gcc.gnu.org/ml/fortran/2019-01/msg00012.html).
polished it and made it ready for gcc-9.  This already worked
quite well.  I added a bit of compile-time simplification (where we can
prove an array is not contiguous). The original library function version
was by Harald, but I replaced that with something simpler; also the
code would have pushed the limits for contributions without
(yet) a copyright assignment in place.

Later, we can also use the gfc_is_not_contiguous to reject
obvious errors when assigning to contiguous pointers or
arguments.

Regression-tested on x86_64-pc-linux-gnu. OK for trunk?

Regards

	Thomas

2019-01-06  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-06  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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p4.diff
Type: text/x-patch
Size: 21358 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190106/2f5b2500/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: is_contiguous_1.f90
Type: text/x-fortran
Size: 849 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190106/2f5b2500/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: is_contiguous_2.f90
Type: text/x-fortran
Size: 1643 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190106/2f5b2500/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: is_contiguous_3.f90
Type: text/x-fortran
Size: 702 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190106/2f5b2500/attachment-0003.bin>


More information about the Gcc-patches mailing list