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

Indirect array addressing in a print statement. ifort 17.01

$
0
0

A simple statement: print *,a(b(1:2)) compiles without a complaint,

Command: ifort -check all -debug all -fpe0 -traceback test.f90

but the execution fails, with the message:

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
span.s1 {font-variant-ligatures: no-common-ligatures}

Run-Time Check Failure. The variable 'var$21' is being used in 'test.f90(11,1)' without being defined

program test

implicit none

real(8) :: a(2),c(2)

integer :: b(2)

a(1:2)=(/10,20/); b(1:2)=(/1,2/)

print *,a(b(1:2))

end program test

There are other ways to do it: e.g. replacing the print statement by:

c(1:2)=a(b(1:2))

print *,c(1:2)

Prints without a complaint

 

 

 


Viewing all articles
Browse latest Browse all 2583

Trending Articles



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