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

Peculiarity of /fpconstant between release and debug in calls

nvaneck
New Contributor I
1,113 Views
I tell the compier to extend all single precision constants to double precicison. When compiling with debug and telling the compiler to check interfaces, I get no warnings. When compiling in relese mode, I get warnings, e.g., for

CALL SUB(0.0)
END

SUBROUTINE SUB(F)
REAL(8) F,D
D=F
END

Not a big deal as I had only 4 instances and changed them to sue 0D0 to be safe but it was surprising.
Normally, I don't have check interfaces on for release mode, so I hadn't noticed it before. The real question is, did the compiler extend the constants in other areas for release and debug mode, and did it in fact do so for the call?



subroutine
0 Kudos
11 Replies
Steven_L_Intel1
Employee
1,113 Views
More likely is that when you changed the default real kind to double, you did so only for the Debug configuration. You have to explicitly select "All configurations" to get the change applied to both.
0 Kudos
nvaneck
New Contributor I
1,113 Views
Not true, it's been this way for years. I just changed the warn interfaces. Otherwise, options are the same except for debug stuff. Sounds like a bug to me--I just hope it's a warning bug and not more serious. Easy for you to check with sample included.
0 Kudos
mecej4
Honored Contributor III
1,113 Views
Easy for you to check with sample included.

I cannot see any sample in this thread other than the short program shown in-line in #0.

That one is special since zero has a special representation -- all zero bits in single and double precision. Therefore, an argument or a function value of zero is tolerant to mismatches between REAL*4 and REAL*8 arguments.
0 Kudos
nvaneck
New Contributor I
1,113 Views

Well, that's the smallest example, which you always ask for, to demo the problem. The warn interfacesoption complains when fpconstant is set, but only in release mode. Here's another with a non-zero:

SUBROUTINE TEST
call sub (0.0)call sub (1.2)
end

subroutine sub(f)
real(8) f,d
d=f
end

D:\Projects\MicrOsiris\PGMS\TEST.F90(6): error #6633: The type of the actual argument differs from the type of the dummy argument. [0.0]

D:\Projects\MicrOsiris\PGMS\TEST.F90(7): error #6633: The type of the actual argument differs from the type of the dummy argument. [1.2]

compilation aborted for D:\Projects\MicrOsiris\PGMS\TEST.F90 (code 1)

And yes, fpconstant specified.

These errors do not appear in debug mode.

0 Kudos
Steven_L_Intel1
Employee
1,113 Views
I can't reproduce this using your example. Please show the build log for the Release build.
0 Kudos
nvaneck
New Contributor I
1,113 Views

This is way to much trouble for what I thought was a heads up on an erroneous error message. It is not a problem for me since the code is correct, and I guess you're sure the fpconstant is correct with the interface warning as well.

------ Build started: Project: MicrOsiris, Configuration: Debug|Win32 ------

Compiling with Intel Visual Fortran Compiler XE 12.1.1.258 [IA-32]...

TEST.F90

Build log written to "file://D:\Projects\MicrOsiris\Debug\BuildLog.htm"

MicrOsiris - 0 error(s), 0 warning(s)

---------------------- Done ----------------------



------ Build started: Project: MicrOsiris, Configuration: Release|Win32 ------

Compiling with Intel Visual Fortran Compiler XE 12.1.1.258 [IA-32]...

TEST.F90

D:\Projects\MicrOsiris\PGMS\TEST.F90(3): error #6633: The type of the actual argument differs from the type of the dummy argument. [0.0]

D:\Projects\MicrOsiris\PGMS\TEST.F90(4): error #6633: The type of the actual argument differs from the type of the dummy argument. [1.2]

compilation aborted for D:\Projects\MicrOsiris\PGMS\TEST.F90 (code 1)

Build log written to "file://D:\Projects\MicrOsiris\Release\BuildLog.htm"

MicrOsiris - 3 error(s), 0 warning(s)

---------------------- Done ----------------------

Options for diagostics are

Yes (/warn:declarations)

Yes (/warn:unused)

Yes (/warn:ignore_loc)

Yes (/warn:truncated_source)

Yes (/warn:uncalled)

Yes (/warn:interfaces)

Fortran 2003 (/stand:f03)

0 Kudos
Steven_L_Intel1
Employee
1,113 Views
Sorry if it's too much trouble, but what you posted is not the build log. I want to see the buildlog.htm in the Release subfolder.
0 Kudos
nvaneck
New Contributor I
1,113 Views
But all I did was compile...

Compiling with Intel Visual Fortran Compiler XE 12.1.1.258 [IA-32]...

ifort /nologo /O3 /Ob0 /heap-arrays0 /Qipo /I"D:\PROJECTS\MICROSIRIS\INCLUDE" /arch:SSE3 /extend_source:132 /noaltparam /standard-semantics /stand:f03 /Qopenmp-report0 /Qpar-report0 /Qvec-report0 /Qdiag-disable:5268,5142,7416,8290,8291 /warn:declarations /warn:unused /warn:ignore_loc /warn:truncated_source /warn:uncalled /warn:interfaces /Qauto_scalar /fpe:1 /fp:strict /fpconstant /module:"Release/" /object:"Release/" /Fd"Release\vc100.pdb" /check:none /libs:qwin /c /Qvc10 /Qlocation,link,"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin" "D:\Projects\MicrOsiris\PGMS\TEST.F90"

D:\Projects\MicrOsiris\PGMS\TEST.F90(3): error #6633: The type of the actual argument differs from the type of the dummy argument. [0.0]

call sub (0.0)

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

D:\Projects\MicrOsiris\PGMS\TEST.F90(4): error #6633: The type of the actual argument differs from the type of the dummy argument. [1.2]

call sub (1.2)

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

compilation aborted for D:\Projects\MicrOsiris\PGMS\TEST.F90 (code 1)

MicrOsiris - 3 error(s), 0 warning(s)

0 Kudos
IanH
Honored Contributor III
1,113 Views
Does your debug build have /real-size:64 ?

Without that I think the error messages are quite valid. I get them here compiling the example in #5 with /warn:all and other debug options.
0 Kudos
Steven_L_Intel1
Employee
1,113 Views
Oh, now I get it. You misunderstand what /fpconstant does. It does not make single precision constants double precision. What it does is maintain all the digits internally until you assign the value to a double (or quad) precision variable. It does not change the kind of the constant.

The purpose of this option is to maintain compatibility for pre-F90 code that did something like this:

double precision pi
pi = 3.1415926535897

Many F77 compilers, including DEC's, would keep all the digits in its internal conversion, and then convert down on the assignment. Fortran 90 doesn't allow that - the above is a "default real kind" constant and extra digits are thrown away. We gave you /fpconstant to get the old behavior. But it doesn't make such constants double precision when passing as arguments.
0 Kudos
nvaneck
New Contributor I
1,113 Views
For some reason, I can't reply to the "Peculiarity of /fpconstant between release and debug in calls" item....

But I do want to thank Stevefor solving the mystery. It'sstrange the debug version didn't catch it, but I know what I have to do now.

Compiling with Intel Visual Fortran Compiler XE 12.1.1.258 [IA-32]...

ifort /nologo /debug:full /Od /I"D:PROJECTSMICROSIRISINCLUDE" /arch:SSE3 /noaltparam /standard-semantics /stand:f03 /Qopenmp-report0 /Qpar-report0 /Qvec-report0 /Qdiag-disable:5142,7416,8290,8291,7410,6009,6463,6135 /warn:declarations /warn:unused /warn:ignore_loc /warn:uncalled /warn:interfaces /real_size:64 /Qauto /Qtrapuv /Qzero /fpconstant /module:"Debug/" /object:"Debug/" /Fd"Debugvc100.pdb" /traceback /check:pointer /check:bounds /check:uninit /libs:qwin /dbglibs /Qmkl:sequential /c /Qvc10 /Qlocation,link,"c:Program Files (x86)Microsoft Visual Studio 10.0VC\bin" "D:ProjectsMicrOsirisPGMSTEST.F90"

MicrOsiris - 0 error(s), 0 warning(s)

0 Kudos
Reply