This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR47040 - Make error message for empty array constructor more helpful/correct
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: "Dominique d'Humières" <dominiq at lps dot ens dot fr>
- Cc: Tobias Burnus <burnus at net-b dot de>, fortran at gcc dot gnu dot org, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 9 Apr 2016 08:39:07 -0700
- Subject: Re: [PATCH] PR47040 - Make error message for empty array constructor more helpful/correct
- Authentication-results: sourceware.org; auth=none
- References: <4C6F6CD1-9AAB-459A-9182-655EDB56C437 at lps dot ens dot fr> <20160407054844 dot GA48073 at troutmask dot apl dot washington dot edu> <9CC17A2B-DC0A-40B4-9696-038170F0F8B7 at lps dot ens dot fr> <20160407135902 dot GA50811 at troutmask dot apl dot washington dot edu> <8E1D4A5A-F220-4A32-B0F2-EC8CC4BF327E at lps dot ens dot fr>
On Sat, Apr 09, 2016 at 12:28:12PM +0200, Dominique d'HumiÃres wrote:
> >>> On Wed, Apr 06, 2016 at 05:44:55PM +0200, Dominique d'HumiÃres wrote:
> >>>> Is the following patch OK (regtested on x86_64-apple-darwin15)? Should it be back ported to the gcc-5 branch?
> >>>
> >>> No and No.
> > Le 7 avr. 2016 Ã 15:59, Steve Kargl <sgk@troutmask.apl.washington.edu> a Ãcrit :
> >
> > The latter is obvious as this "fixes" neither a regression
> > nor documentation.
>
> I wonât argue.
>
> > For the former, see Fortran 95, section 4.5.
> >
> > --
> > steve
>
>
> Are you referring to
>
> (a) An empty sequence forms a zero-sized rank-one array.
>
> (b) The type and type parameters of an array constructor are those of the ac-value expressions.
>
> (c) something else?
>
Fortran 95 doesn't have a type-spec in an array constructor.
Fortran 95 explicitly states
"The type and type parameters of an array constructor are
those of the ac-value expressions."
(/ /) is valid Fortran 95 syntax while (/ type-spec :: /) is
not valid. type-spec was introduced in Fortran 2003. The
error message as written is correct.
(/ /) is empty.
(/type-spec :: /) is not empty, and is invalid Fortan 95.
(/1, 2, 3/) is not empty and has a type of INTEGER.
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. Adding any text referring
to type-spec is wrong.
--
Steve