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

Compiler version differences

postaquestion
Novice
489 Views

Yesterday I encountered a problem with your Fortran 95 compiler, which I have illustrated by the following test program.

program test

!.... EXAMPLE OF COMPILER PROBLEM

implicit none

real, parameter :: pi = 3.14159

real :: exp_pi = exp(pi)
real :: log_pi = log(pi)
real :: root_pi = sqrt(pi)

write(*, *) 'pi', pi
write(*, *) 'exp_pi', exp_pi
write(*, *) 'log_pi', log_pi
write(*, *) 'root_pi', root_pi

end program test

This program compiles and run correctly on one of my computers that uses your fce compiler 10.0.025.

However, the same program will not compile on another of my computers that uses your fc (IA-32) compiler 10.0.023. Here are the error messages:


fortcom: Error: test.f, line 9: This intrinsic function is invalid in constant expressions. [EXP]
real :: exp_pi = exp(pi)
----------------------------------^
fortcom: Error: test.f, line 9: This is not a valid initialization expression. [EXP]
real :: exp_pi = exp(pi)
----------------------------------^
fortcom: Error: test.f, line 11: This intrinsic function is invalid in constant expressions. [SQRT]
real :: root_pi = sqrt(pi)
-----------------------------------^
fortcom: Error: test.f, line 11: This is not a valid initialization expression. [SQRT]
real :: root_pi = sqrt(pi)
-----------------------------------^
compilation aborted for test.f (code 1)
Exit 1

NOTE:

1. The IA-32 compiler does not complain about log(pi), but it will not accept exp(pi). I don't see the difference.

2. I guess that the Fortran standard is not explicit about what is and is not allowed in initializing variables or constants, but your compiler teams should be:
- consistent within one compiler - that is either allow or disallow exp(pi) and log(pi) and sqrt(pi)
- consistent across your different compilers - fc and fce

Something to consider as you work on version 10.0.0XX

0 Kudos
1 Reply
Steven_L_Intel1
Employee
489 Views
It's the same compiler, at least the part that would issue this error, across architectures. I don't have 10.0.023 handy, but I tried it with 10.0.026 on both IA-32 and Intel 64 and saw no difference (and no errors.)

Was the 10.0.023 system a Linux compiler? The initial 10.0 release on Windows was 10.0.025.

What happens if you use the current update (10.0.026 on Windows, 10.0.025 on Linux)
0 Kudos
Reply