public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/45424] F2008: Add is_contiguous intrinsic
Date: Wed, 09 May 2012 15:38:00 -0000	[thread overview]
Message-ID: <bug-45424-4-JpiUbIv5zo@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-45424-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45424

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-05-09 15:36:40 UTC ---
Created attachment 27359
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27359
Draft patch: is_contiguous.diff

Attached is a mostly ready patch for IS_CONTIGUOUS.

The main TODO is to understand when IS_CONTIGUOUS should print .TRUE. and when
.FALSE. The standard is not very clear about it, cf. 5.3.7 of F2008.


a) Array element with nonzero strides (which is still a single array element):
"a(1:1:1)" vs. "a(1:1:5)". With the attached patch but also with ifort and
crayftn, the result is .true. and .false. The attached patch only checks the
"stride", ignoring the number of elements.

b) The same - but instead of a single element, using zero-sized arrays:
a(2:1:1) vs. a(2:1:2).

c) The following example is mishandled as we have a stride and not a stride
multiplied (sm):

type t
  integer :: i, j
end type t
type(t) :: x(5)
print *, is_contiguous(x(:)) ! Shall be (and is) true
print *, is_contiguous(x(:)%i) ! Shall be false - but prints "true".
end

The fortran-devel solution would be to use: sm == TYPE_SIZE(a%i). The trunk
solution is to compare the array spec's object "a" with the the type-size of
"a%i" - and if it differs to abort.

d) The gfc_is_simply_contiguous function needs to be refined and extended - and
a "gfc_is_simply_noncontiguous" has to be added.

e) More tests are needed - including polymorphic arrays and compile-time checks
for the code in simplify.c. [Which is related to (d).]

f) For TS29113, one needs to handle assumed-rank arrays, including rank-1 ones.
Again the question is whether the dummy argument associated with a scalar is
then contiguous or not.


       reply	other threads:[~2012-05-09 15:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-45424-4@http.gcc.gnu.org/bugzilla/>
2012-05-09 15:38 ` burnus at gcc dot gnu.org [this message]
2012-05-09 16:08 ` burnus at gcc dot gnu.org
2013-04-19 21:12 ` quantheory at gmail dot com
2013-04-20 17:41 ` [Bug fortran/45424] [F2008] Add IS_CONTIGUOUS intrinsic janus at gcc dot gnu.org
2013-12-20 23:20 ` [Bug fortran/45424] [F08] " janus at gcc dot gnu.org
2020-07-29 10:18 ` markeggleston at gcc dot gnu.org
2020-07-29 14:32 ` dominiq at lps dot ens.fr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-45424-4-JpiUbIv5zo@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).