This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: parenthesis parsing issue


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]