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

Warning # 6009, possible bug?

$
0
0

I don't really understand why the compiler is issuing warning #6009 to me.

program inibug

	  implicit none

	  integer ,parameter :: WP = kind(1.0D0)

	  real(WP) ,parameter :: offsets(3) = real([0.0D0 ,10.0D8 ,10.0D9],WP)

	  print*, offsets

	end program

$ ifort --version

	ifort (IFORT) 13.0.2 20130314

	Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.
$ ifort -warn -syntax-only -stand f08 reproducer-ini.f90 

	reproducer-ini.f90(4): warning #6009: Fortran 2008 specifies that an elemental intrinsic function here be of type integer or character and each argument must be an initialization expr of type integer or character .   [REAL]

	  real(WP) ,parameter :: offsets(3) = real([0.0D0 ,10.0D8 ,10.0D9],WP)

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

To be honest, I'm not that familiar with the changes that were made in f03/f08 to initialization expressions, but I don't understand why it says it needs to be an integer or character. Is this a bug?

The goal of initializing this array this way is to be able to set the working floating point precision globally throughout the code using a constant (WP) while still being able to initialize this constant array, offsets to values reasonably close to the floating point values I am after, then perform any type conversion to increase or decrease the precision. I actually realized that the best way to do this was via E notation and literal real constants ([0.0_WP ,10.0E8_WP ,10.0E9_WP]) and then I don't need to call real(), but either way, I don't understand why I am getting this warning.


Viewing all articles
Browse latest Browse all 2583

Trending Articles



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