[Bug fortran/45424] [F08] Add IS_CONTIGUOUS intrinsic

2020-07-29 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45424
Bug 45424 depends on bug 53298, which changed state.

Bug 53298 Summary: ICE in gfc_conv_scalarized_array_ref for ARRAY + substring
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53298

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

[Bug fortran/45424] [F08] Add IS_CONTIGUOUS intrinsic

2020-07-29 Thread markeggleston at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45424
Bug 45424 depends on bug 53298, which changed state.

Bug 53298 Summary: ICE in gfc_conv_scalarized_array_ref for ARRAY + substring
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53298

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/45424] [F08] Add IS_CONTIGUOUS intrinsic

2019-01-07 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45424

Thomas Koenig  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||tkoenig at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #10 from Thomas Koenig  ---
Implemented, closing.

Harald, thanks a lot for picking this up again and for preparing
the patch.

[Bug fortran/45424] [F08] Add IS_CONTIGUOUS intrinsic

2019-01-07 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45424

--- Comment #9 from Thomas Koenig  ---
Author: tkoenig
Date: Mon Jan  7 19:30:28 2019
New Revision: 267657

URL: https://gcc.gnu.org/viewcvs?rev=267657&root=gcc&view=rev
Log:
2019-01-07  Thomas Koenig  
Harald Anlauf 
Tobias Burnus 

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  
Harald Anlauf 
Tobias Burnus 

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  
Harald Anlauf 
Tobias Burnus 

* gfortran.dg/is_contiguous_1.f90: New test.
* gfortran.dg/is_contiguous_2.f90: New test.
* gfortran.dg/is_contiguous_3.f90: New test.


Added:
trunk/gcc/testsuite/gfortran.dg/is_contiguous_1.f90
trunk/gcc/testsuite/gfortran.dg/is_contiguous_2.f90
trunk/gcc/testsuite/gfortran.dg/is_contiguous_3.f90
trunk/libgfortran/intrinsics/is_contiguous.c
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/check.c
trunk/gcc/fortran/expr.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/intrinsic.c
trunk/gcc/fortran/intrinsic.h
trunk/gcc/fortran/intrinsic.texi
trunk/gcc/fortran/iresolve.c
trunk/gcc/fortran/simplify.c
trunk/gcc/fortran/trans-decl.c
trunk/gcc/fortran/trans-intrinsic.c
trunk/gcc/fortran/trans.h
trunk/gcc/testsuite/ChangeLog
trunk/libgfortran/ChangeLog
trunk/libgfortran/Makefile.am
trunk/libgfortran/Makefile.in
trunk/libgfortran/gfortran.map
trunk/libgfortran/libgfortran.h

[Bug fortran/45424] [F08] Add IS_CONTIGUOUS intrinsic

2019-01-03 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45424

Harald Anlauf  changed:

   What|Removed |Added

  Attachment #45322|0   |1
is obsolete||

--- Comment #8 from Harald Anlauf  ---
Created attachment 45332
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45332&action=edit
Corrected update of Tobias' patch to 9-trunk (except for ChangeLog)

This version corrects the previous attempt which broke the original patch.
It comes with an additional testcase that checks assumed rank/assumed type.

[Bug fortran/45424] [F08] Add IS_CONTIGUOUS intrinsic

2019-01-02 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45424

Harald Anlauf  changed:

   What|Removed |Added

  Attachment #45292|0   |1
is obsolete||

--- Comment #7 from Harald Anlauf  ---
Created attachment 45322
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45322&action=edit
Extended Update of Tobias' patch to 9-trunk (except for ChangeLog)

I've updated Tobias' patch, adding a runtime library function to handle
assumed rank arrays (not sure if this is the right way).  This now works
for the following testcase:

program is_contiguous_2
  implicit none
  real, allocatable :: b(:,:)
  allocate(b(10,10))
  if (fail (b,  .true.) ) stop 1
  if (fail (b(::1,::1), .true.) ) stop 2
  if (fail (b(::2,::1), .false.)) stop 3
  if (fail (b(::1,::2), .false.)) stop 4
  if (fail (b(:10,:10), .true. )) stop 5
  if (fail (b(: 9,:10), .false.)) stop 6
contains
  pure logical function fail (x, expect)
!   type(*), dimension(..), intent(in) :: x  ! This should work, too
real,dimension(..), intent(in) :: x
logical,intent(in) :: expect
fail = is_contiguous (x) .neqv. expect
  end function fail
end program

I don't know how to handle assumed type; I need help by somebody else
who is interested in pursuing this.

Thanks to whoever will pick this up.

[Bug fortran/45424] [F08] Add IS_CONTIGUOUS intrinsic

2018-12-27 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45424

--- Comment #6 from Harald Anlauf  ---
Created attachment 45292
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45292&action=edit
Update of Tobias' patch to 9-trunk (except for ChangeLog)

I've tried to update Tobias' patch so that it compiles with 9-trunk
and adjusted his testcase so that it uses STOP instead of call abort ().

There's one problem left and one question.

The problem is that I'm getting one failure with the following test:

  implicit none
  real, allocatable :: a(:), b(:,:)
  integer :: k = 0

  allocate(a(5), b(10,10))
  call test (a, .true.)
  call test (b, .true.)
  call test (b(::1,::1), .true.)
  call test (b(::2,::1), .false.)
  call test (b(::1,::2), .false.)  ! This test fails currently
contains
  subroutine test (x, res)
!   type(*), dimension(..), intent(in) :: x  ! Should this be allowed?
real,dimension(..), intent(in) :: x
logical,intent(in) :: res
k = k + 1
if (is_contiguous (x) .eqv. res) return
print *, "Failure of test", k
stop "FAIL"
  end subroutine test
end program

Maybe something else needs to be updated.

Furthermore, should type(*), dimension(..) be allowed?  Opinions?
I tend to think so.  Does this need explicit coding as for e.g. SIZEOF,
or are there better ways?

[Bug fortran/45424] [F08] Add IS_CONTIGUOUS intrinsic

2018-12-27 Thread anlauf at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45424

--- Comment #5 from Harald Anlauf  ---
Looking at the F2k18 draft, I see some updates and clarifications:

16.9.105 IS_CONTIGUOUS (ARRAY)
Description. Array contiguity test (8.5.7).
Class. Inquiry function.
Argument. ARRAY may be of any type. It shall be assumed-rank or an array. If it
is a pointer it shall be associated.
Result Characteristics. Default logical scalar.
Result Value. The result has the value true if ARRAY has rank zero or is
contiguous, and false otherwise.

[Example elided]

The clarification about rank zero is certainly helpful.

Furthermore:

8.5.7 CONTIGUOUS attribute

NOTE 1
If a derived type has only one component that is not zero-sized, it is
processor dependent whether a structure component of a contiguous array
of that type is contiguous. That is, the derived type might contain padding
on some processors.

This gives some freedom for a "conservative" implementation of the
intrinsic.

[Bug fortran/45424] [F08] Add IS_CONTIGUOUS intrinsic

2018-01-30 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45424
Bug 45424 depends on bug 36825, which changed state.

Bug 36825 Summary: [F08] Rank > 7 arrays  [will break library ABI]  libgfortran 
I/O+intrinsics:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36825

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug fortran/45424] [F08] Add IS_CONTIGUOUS intrinsic

2013-12-20 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45424

janus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2013-12-20
Summary|[F2008] Add IS_CONTIGUOUS   |[F08] Add IS_CONTIGUOUS
   |intrinsic   |intrinsic
 Ever confirmed|0   |1