This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/45424] F2008: Add is_contiguous intrinsic
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 09 May 2012 16:02:18 +0000
- Subject: [Bug fortran/45424] F2008: Add is_contiguous intrinsic
- Auto-submitted: auto-generated
- References: <bug-45424-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45424
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-05-09 16:02:18 UTC ---
(In reply to comment #1)
> a) Array element with nonzero strides
I meant: A an array containing a single element and having a nonunity stride.
> type t
> integer :: i, j
> end type t
> print *, is_contiguous(x(:)%i) ! Shall be false - but prints "true".
Those kind of arguments can get really tricky! Assume as component a:
integer :: i(1) ! or "i(2)
or
class(t), allocatable :: a
or
integer, allocatable :: a(:)
which is accessed as "is_contiguous(x(:)%a(1))".
Intel and Cray handle it simply: by always returning "F" - even for "type t;
integer :: i; end type", which should have no padding and be contiguous in
memory. We could do the same - or we rule out BT_CLASS, arrays and coarrays and
do then a size check: whole derived type == expr->ts.type size.
Another issue are substrings. For those one needs to check that the substring
range matches the string length.