Quantcast
Channel: Intel® Software - Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2746

Nonintegers in initialization expressions

$
0
0

Hello,

I've got a question concerning ifort warning messages. When I compile the following code:

program test_numbers
  implicit none

	  double precision, parameter :: pi = 3.141592653589793d+0

	  double precision, parameter :: pi12 = sqrt(pi)

	  double precision, parameter :: pi13 = pi**(1.d+0 / 3.d+0)

	  

	  write (*,*) "pi = ", pi

	  write (*,*) "pi12 = ", pi12

	  write(*,*) "pi13 = ", pi**(1.d+0 / 3.d+0)

	end program test_numbers

Using "ifort -std03 test.F90" or "ifort -std08 test.F90", a get a warning

Quote:

test.F90(5): warning #6187: Fortran 2003 requires an INTEGER data type in this context.

  double precision, parameter :: pi13 = pi**(1.d+0 / 3.d+0)

However, a Fortran standard allows the use of any data types in initialization expressions from 2003 and beyond, see 7.1.7(4) in http://www.j3-fortran.org/doc/year/04/04-007.pdf.

This is not a big problem, however, since my code is a part of a large project, other people might get worried about the warning messages they're getting. The flags "-std03" or "-std08" are used by the configure script of the code.

My question is: should ifort really cast a warning message for F2003 and F2008 standards in such a case?

Thanks a lot for your help.


Viewing all articles
Browse latest Browse all 2746

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>