Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28602 Discussions

Nonintegers in initialization expressions

Luke_R_
Beginner
410 Views

Hello,

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

[fortran]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[/fortran]

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

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.

0 Kudos
3 Replies
Steven_L_Intel1
Employee
410 Views

This is a F95 restriction that in exponentiation, the power had to be integer - we apparently missed noting that it was relaxed in F2003. I'll let the developers know - thanks.

0 Kudos
Steven_L_Intel1
Employee
410 Views

This has been fixed for a future release.

0 Kudos
Luke_R_
Beginner
410 Views

Thanks a lot for your help!

0 Kudos
Reply