forrtl: severe (71): integer divide by zero

forrtl: severe (71): integer divide by zero

I encountered a error in the step of runing but the process of compiling is OK(my compiler is ifort 11.0),The problem is as follows :

      I want to read two data file of nc format , the The original code is :

 

program chenlei
15 | use netcdf
16 | implicit none
17 | integer, parameter :: dbl=selected_real_kind(p=13)
18 | integer :: lev_dimid,lat_dimid,lon_dimid,t_dimid,varid,varid_lon,varid_lat,varid_lev,i,j,stat,ncid,k,t
19 | integer,dimension(4):: start,count
20 | real(kind=dbl),allocatable,dimension(:,:,:,:) :: comp1,comp2,diff
21 | real(kind=dbl),allocatable,dimension(:) :: lev
22 | real(kind=dbl),allocatable,dimension(:,:) :: lon
23 | real(kind=dbl),allocatable,dimension(:,:) :: lat
24 | logical,allocatable,dimension(:,:,:,:) :: mask
25 | character (len = 999) :: file_name,nu,path1,path2,output,units,level_units
26 | namelist /mylist/ varid,varid_lon,varid_lat,varid_lev,start,count,t,path1,path2,output,units,level_units
27 | open(unit=333,file="mylist",delim="apostrophe")
28 | read(unit=333,nml=mylist)
29 | close(unit=333)
30 | !call check(nf90_get_var(ncid, varid=3, values=sst(:,:,3),start=[121,61,2,1],count=[151,61,1,1]))
31 | allocate(comp1(count(1),count(2),count(3),count(4)),mask(count(1),count(2),count(3),count(4)),lon(count(1),count(2)),lat(count(1),count(2)),lev(count(3)))
32 | allocate(diff,comp2,source=comp1)
33 | file_name = path1
34 | call check(nf90_open(trim(adjustl(file_name)), nf90_nowrite, ncid=ncid))
35 | call check(nf90_get_var(ncid,varid=varid_lon,values=lon,start=[start(1),start(2)],count=[count(1),count(2)]))
36 | call check(nf90_get_var(ncid,varid=varid_lat,values=lat,start=[start(1),start(2)],count=[count(1),count(2)]))
37 | call check(nf90_get_var(ncid,varid=varid_lev,values=lev,start=[start(3)],count=[count(3)]))
38 | call check(nf90_get_var(ncid,varid=varid, values=comp1,start=start,count=count))
39 | call check(nf90_close(ncid))
40 | file_name = path2
41 | call check(nf90_open(trim(adjustl(file_name)), nf90_nowrite, ncid=ncid))
42 | call check(nf90_get_var(ncid,varid=varid, values=comp2,start=start,count=count))
43 | call check(nf90_close(ncid))
44 | mask=abs(comp1)>1000
45 | where(mask)
46 | | comp1=0.0_dbl
47 | | comp2=0.0_dbl
48 | end where
49 | diff=comp2-comp1
50 | write(*,*) sum(diff*diff)
051 | stop

Compile and link : ifort -traceback -o filter -I/snfs01/elfin/qqydss/netcdf_4.2/include -L/snfs01/elfin/qqydss/netcdf_4.2/lib -lnetcdf -lnetcdff -limf filter.f90

The compiling and linking is OK , however when exceute the filter : ./filter , an error ermerged :

forrtl: severe (71): integer divide by zero
Image PC Routine Line Source
filter 0000000000411A49 Unknown Unknown Unknown
filter 000000000040F456 Unknown Unknown Unknown
libnetcdff.so.5 00002B991F694CF4 Unknown Unknown Unknown
filter 0000000000408DFF MAIN__ 43 filter.f90
filter 000000000040794C Unknown Unknown Unknown
libc.so.6 0000003DB0E1D8B4 Unknown Unknown Unknown
filter 0000000000407859 Unknown Unknown Unknown

Then I modify the code in line 31 and comment he line 32 as :

31 |allocate(comp1(count(1),count(2),count(3),count(4)),comp2(count(1),count(2),count(3),count(4)),mask(count(1),count(2),count(3),count(4)) ,lon(count(1),count(2)),lat(count(1),count(2)),lev(count(3)))
32 | ! allocate(diff,comp2,source=comp1)

that is ,I directly allocate the memory for variable comp2 instead of allocate it using source syntax. Then everything is OK. Why? Any reply will be appreciated. There is no such problem in compiler composer_xe_2013.1.117.

2 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

We have fixed a number of issues with ALLOCATE(SOURCE=) over the years. Compiler version 11.0 is quite old. Since you don't see the problem in a more recent compiler, I recommend you use the newer version.

Steve - Intel Developer Support

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi