public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mikael Morin <mikael.morin@sfr.fr>
To: Thomas Koenig <tkoenig@netcologne.de>,
	"fortran@gcc.gnu.org"	<fortran@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch, Fortran] Simplify lbound
Date: Sat, 25 Apr 2015 18:13:00 -0000	[thread overview]
Message-ID: <553BD925.3050401@sfr.fr> (raw)
In-Reply-To: <553B7BA4.6040103@netcologne.de>

Le 25/04/2015 13:33, Thomas Koenig a écrit :
> Hello world,
> 
> this is a simplification for calculating the lboud of assumed-shape
> arrays - it is usually one, or whatever the user specified as
> lower bound (if constant).
> 
Hello,

I've double-checked in the standard, and it seems it is not possible to
simplify after all:

	If ARRAY is a whole array and either ARRAY is an assumed-size
	array of rank DIM or dimension DIM of ARRAY has nonzero extent,
	LBOUND (ARRAY, DIM) has a value equal to the lower bound for
	subscript DIM of ARRAY. Otherwise the result value is 1.

We can't tell whether the array is zero-sized, so we can't tell the
lbound value.


As you may want to simplify in the limited scope of the matmul inlining,
I'm giving comments about the patch (otherwise you can ignore them):
 - No need to check for allocatable or pointer, it should be excluded by
as->type == AS_ASSUMED_SHAPE (but does no harm either).
 - Please modify the early return condition:
     if (as && (as->type == AS_DEFERRED || as->type == AS_ASSUMED_SHAPE
	        || as->type == AS_ASSUMED_RANK))
       return NULL;
   and let the existing code do the simplification work.


Or drop the lbound simplification idea, and fetch the lbound "by hand"
at matmul inline time.

Mikael

  reply	other threads:[~2015-04-25 18:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-25 11:34 Thomas Koenig
2015-04-25 18:13 ` Mikael Morin [this message]
2015-04-27 18:45   ` Thomas Koenig
2015-04-27 19:22     ` Thomas Koenig
2015-04-30 18:46     ` Mikael Morin
2015-05-01 21:04       ` Mikael Morin
2015-05-03 20:38         ` Thomas Koenig
2015-05-10 13:59           ` Mikael Morin
2015-05-10 20:43             ` H.J. Lu
2015-05-10 22:08               ` Thomas Koenig
2015-05-11 13:17                 ` Mikael Morin
2015-05-12  7:08                   ` Thomas Koenig
2015-05-12 10:04                     ` Mikael Morin
2015-05-02 10:50     ` H.J. Lu

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=553BD925.3050401@sfr.fr \
    --to=mikael.morin@sfr.fr \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tkoenig@netcologne.de \
    /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).