Is this ok with fortran standard?

Is this ok with fortran standard?

tropfen's picture

Hello,

please have a look at the following small program:

program Test_Sort
  implicit none
  data cDD/'111','222'/
  character(len=3),dimension(2) :: cDD
  write(6,'(2(a,x))') cDD
end program Test_Sort

In this program the data assignment to cDD is done before cDD is definied.
This program compiles and is producing correct results in IVF 13.1.2.190

Is this conform to the fortran standard? Or is this a accidental result?

Thanks in advance

Frank

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Tim Prince's picture

ifort /stand tropfen.f90

....

tropfen.f90(4): warning #8226: The variable typing occurred after the DATA state
ment and changed its implicit typing.   [CDD]
      character(len=3),dimension(2) :: cDD
---------------------------------------^
tropfen.f90(3): warning #7159: Array declarations for a symbol appearing after t
he DATA statement is not permitted in standard Fortran 2003.   [CDD]
    data cDD/'111','222'/
---------^
tropfen.f90(5): warning #7423: Fortran 2003 requires a count prefix for the X ed
it descriptor.   [a,x]
        write(6,'(2(a,x))') cDD
--------------------^

Yes, ifort by default accepts many extensions inherited from predecessors, but in these cases adheres to the standard requirement that a means is provided to diagnose them.

Sergey Kostrov's picture

I think Tim used a Warning Level /W4 or /W5 to display these warnings.

Steve Lionel (Intel)'s picture

No, he used /stand, as he showed. ifort doesn't understand /W4 or /W5.

Steve

Login to leave a comment.