-std03 and openmp directives

-std03 and openmp directives

Hi,

When using command line option "-std03", I get warnings that "Fortran 2003 does not allow this statement or directive" with source (see below) that contains openmp compiler directives. As I normally compile source with "-warn error" enabled, it doesn't compile.

Everything following an exclamation mark is comment, so I would think that openmp compiler directives would be ignored when checking source for consistency with the standards. Or am I wrong here?

$ ifort -o tst test.f90 -std03 -openmp -warn error

fortcom: Error: test.f90, line 4: Fortran 2003 does not allow this statement or directive.

!$omp parallel private(id)

--------^

fortcom: Error: test.f90, line 7: Fortran 2003 does not allow this statement or directive.

!$omp barrier

--------^

fortcom: Error: test.f90, line 12: Fortran 2003 does not allow this statement or directive.

!$omp end parallel

------------^

compilation aborted for test.f90 (code 1)

where test.f90 is:

program hello90

use omp_lib

integer:: id, nthreads

!$omp parallel private(id)

id = omp_get_thread_num()

write (*,*) 'Hello World from thread', id

!$omp barrier

if ( id == 0 ) then

nthreads = omp_get_num_threads()

write (*,*) 'There are', nthreads, 'threads'

end if

!$omp end parallel

end program

Greetings,

Wim

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

Our position is that directives are "statements with funny spellings" and that since they are NOT treated as comments, they are by nature extensions. We had a rather protracted debate about this some years ago and ended up with the current position. I'll note that I was originally on the "they're comments" side but came around to the other view.

If a program behaves differently with and without directives, then the directives are in fact statements and are subject to extension warnings.

Steve - Intel Developer Support

Steve,

Then would it be fair to say that -std03 and -openmp are mutually exclusive?

If so, then why not produce a warning message to the effect (or error if -warn_error in effect).

And on the flip-side, what arethe rules for using OpenMP with F2003?
(Where would you recommend for us to obtain good documentation regarding this?)

Jim Dempsey

www.quickthreadprogramming.com

Jim, I don't understand the question. One asks for standards checking (-std03) if you want to be alerted if you use any source constructs that are extensions to Fortran 2003. These are warnings and do not prevent your use of OpenMP.

If you want to add OpenMP to your application, it is probably best to not enable both OpenMP directive processing and standards checking at the same time. This does not prevent you from using F2003 features.

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today