This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: parenthesis parsing issue
- From: Tobias Burnus <burnus at net-b dot de>
- To: Paul Kapinos <kapinos at rz dot rwth-aachen dot de>
- Cc: fortran at gcc dot gnu dot org
- Date: Mon, 15 Oct 2012 20:03:10 +0200
- Subject: Re: parenthesis parsing issue
- References: <507C4A05.5030807@rz.rwth-aachen.de>
Hello Paul,
Paul Kapinos wrote:
Please have a look at the attached example.
Seems as if you have found a bug in your program, which other compilers
wrongly (or as vendor extension) accept.
Your program has:
((nint(pmin_alt(i_komp,i_bz)),"-",nint(pmax_alt(i_komp,i_bz))),i_bz=0, max_bet_mod-1)
A simplified (valid) version is:
write (*,*) ( i, i+1, i=1,5 )
That's what the standard calls an io-implied-do. The standard (here: Fortran 2008*) defines it as:
R911 write-stmt is WRITE ( io-control-spec-list ) [ output-item-list ]
with
R917 output-item is expr
or io-implied-do
R918 io-implied-do is ( io-implied-do-object-list , io-implied-do-control )
R919 io-implied-do-object is input-item
or output-item
For
write (*,*) ( i, i+1, i=1,5 )
one has an io-implied-object-list consisting of the expressions "i" and "i+1" followed by the io-implied-do-control.
However, you wrote something like:
write (*,*) ( (i, i+1), i=1,5 )
The inner "(...)" implies an expression but "(i, i+1)" is not a valid expression; on the other hand, it is also not an io-implied-do. Hence, it is invalid.
Tobias
* Cf. links at http://gcc.gnu.org/wiki/GFortranStandards