public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: "Dominique d'Humières" <dominiq@lps.ens.fr>
Cc: Tobias Burnus <burnus@net-b.de>,
	fortran@gcc.gnu.org,        gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] PR47040 - Make error message for empty array constructor more helpful/correct
Date: Sat, 09 Apr 2016 16:13:00 -0000	[thread overview]
Message-ID: <20160409161315.GA47482@troutmask.apl.washington.edu> (raw)
In-Reply-To: <7EBFF209-4B2B-4C33-BCA0-7F3996AA3E56@lps.ens.fr>

On Sat, Apr 09, 2016 at 05:56:12PM +0200, Dominique d'Humières wrote:
> 
> > (/ /) is valid Fortran 95 syntax
> > ...
> > 
> > program foo
> >   call bar((/ /))
> > end program foo
> > 
> > % gfc -c -std=f95 foo.f90
> > foo.f90:2:17:
> > 
> >    call bar((/ /))
> >                 1
> > Error: Empty array constructor at (1) is not allowed
> > 
> > The above error is correct.  
> 
> Well the two assertions look contradictory: if (/ /) is valid
> Fortran 95 syntax why is it  not allowed?

It is valid syntax because of 

"An empty sequence forms a zero-sized rank-one array."

It seems that J3 saw the error in their ways as (/ /) is clearly
an empty array constructor, and fixed the possibility of creating
a typeless zero-sized, rank-one array.

> > Adding any text referring
> > to type-spec is wrong.
> > 
> 
> Are you considering (/ ( i, i = 1, 0 ) /) as non empty?
> 

It is a zero-sized rank-one array with type INTEGER.  

"The type and type parameters of an array constructor are those
 of the ac-value expressions."

ac-value    is  expr
            or  ac-implied-do

"If an ac-value is an ac-implied-do, it is expanded to form an ac-value
sequence under the control of the ac-do-variable..."

-- 
Steve

  reply	other threads:[~2016-04-09 16:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-06 15:45 Dominique d'Humières
2016-04-07  5:48 ` Steve Kargl
2016-04-07  5:51   ` Dominique d'Humières
2016-04-07 13:59     ` Steve Kargl
2016-04-09 10:28       ` Dominique d'Humières
2016-04-09 15:39         ` Steve Kargl
2016-04-09 15:58           ` Dominique d'Humières
2016-04-09 16:13             ` Steve Kargl [this message]
2016-04-09 16:51               ` Dominique d'Humières
2016-04-09 17:03                 ` Steve Kargl
2016-04-09 18:43                   ` [PATCH withdrawn] PR47040 - Make error message for empty array constructor more helpful/correct, closed as INVALID Dominique d'Humières

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=20160409161315.GA47482@troutmask.apl.washington.edu \
    --to=sgk@troutmask.apl.washington.edu \
    --cc=burnus@net-b.de \
    --cc=dominiq@lps.ens.fr \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@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).