program Bug call main() ! contains end program Bug Module errorModule double precision,allocatable,dimension(:) :: readInArray, tmpWork integer :: n,i character(len=300) :: filout end Module errorModule subroutine main() use errorModule n = 59925 allocate(tmpWork(n+10)) do i=1,n+10 tmpWork(i) = i enddo allocate(readInArray(62267)) write(filout,'("PhysicalMapInput.txt")') open(unit=1001,file=trim(filout),status="old") read(1001,*) readInArray(tmpWork(1:n)) print *,readInArray deallocate(readInArray) deallocate(tmpWork) end subroutine main
I believe I have found an error in the intel ifort compiler (the 2017 version). I have tested this with ifort 16 and the bug is not there.
I have written the above program to demonstrate this.
When I run the following:
ifort error.f90 -traceback -g -debug all -warn all -check bounds -check format -check output_conversion -check pointers -ftrapuv -check all -gen-interfaces -warn interfaces
I get the following error:
forrtl: severe (194): Run-Time Check Failure. The variable 'var$76' is being used in 'error.f90(36,1)' without being defined
Image PC Routine Line Source
a.out 000000010D72464C _main_ 36 error.f90
a.out 000000010D725574 _MAIN__ 2 error.f90
a.out 000000010D723CAE Unknown Unknown Unknown
As already mentioned. This does not happen in the 2016 version.