Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Important Update: Community Platform Migration​. Learn more​>
29649 Discussions

problem with allocatable array of derived types

vivekrao4
Beginner
2,225 Views

Compiling and running the code

module dt_mod
implicit none
type, public :: dt
integer :: i=0
end type dt
end module dt_mod

module main_mod
! triggers error in ifort W_FC_C_9.1.028
use dt_mod, only: dt
implicit none
contains
subroutine xmain()
type(dt), allocatable :: dt_vec(:)
print*,"done"
stop
end subroutine xmain
end module main_mod

program xx
use main_mod, only: xmain
print*,"calling xmain"
call xmain()
print*,"after calling xmain"
end program xx

using W_FC_C_9.1.028 with the options /traceback /check:all /warn:all /warn:unused

I get a crash:

xifort_alloc_bug.f90(14) : Info: This variable has not been used. [DT_VEC]
type(dt), allocatable :: dt_vec(:)
-------------------------^
calling xmain
forrtl: severe (408): fort: (8): Attempt to fetch from allocatable variable DT_VEC when it is not allocated

Image PC Routine Line Source
ifort_xifort_allo 0044709E Unknown Unknown Unknown
ifort_xifort_allo 00444350 Unknown Unknown Unknown
ifort_xifort_allo 00405CAE Unknown Unknown Unknown
ifort_xifort_allo 00405E64 Unknown Unknown Unknown
ifort_xifort_allo 004011B1 _MAIN_MOD_mp_XMAI 13 xifort_alloc_bug.f90
ifort_xifort_allo 0040105B _MAIN__ 23 xifort_alloc_bug.f90
ifort_xifort_allo 0044D1D8 Unknown Unknown Unknown
ifort_xifort_allo 00432408 Unknown Unknown Unknown
kernel32.dll 7C816D4F Unknown Unknown Unknown

I think the program is valid. It works with g95 and gfortran.

Vivek Rao

0 Kudos
9 Replies
Steven_L_Intel1
Employee
2,225 Views
I am fairly certain that this is a bug we found and fixed about two weeks ago, but I'll check with the developer who made the fix tomorrow.
0 Kudos
Steven_L_Intel1
Employee
2,225 Views

No, different bug. It is specifically related to /check:pointer which is making an improper check. I'll report it.

0 Kudos
vivekrao4
Beginner
2,225 Views

Thanks for your reply.

It seems that /check:all turns on the the option /check:pointer

When I type ifort /? at the command line I see

/check:
check run-time conditions
keywords: all (same as /4Yb), none (same as /nocheck, /4Nb),
[no]arg_temp_created, [no]bounds,[no]format,
[no]output_conversion, [no]power, [no]uninit, [no]args

There is no mention of a /check:pointer option. I suggest mentioning it here and in the online documentation.

0 Kudos
Steven_L_Intel1
Employee
2,225 Views
It's new and in the release notes. It will make it to the documentation in the next release.
0 Kudos
Micah_S_
Beginner
2,225 Views
Hi,

I found this post upon search of the same problem. I am able to run my program properly on a different maching using the i386 9.0 ifort compiler. And using the 64_x86 - 9.1.040 compiler: I get the following error:

forrtl: severe (408): fort: (8): Attempt to fetch from allocatable variable TRNX when it is not allocated.

After reading the replies, I'm not sure how to fix the problem? Suggestions please?
0 Kudos
Steven_L_Intel1
Employee
2,225 Views
Don't use /check (or at least disable /check:pointer, which was not in 9.0).
0 Kudos
Micah_S_
Beginner
2,225 Views
After posting, I realized this topic was for the visual fortran, whereas my issue was for the the fortran compiler for linux. Regardless, this solved my issue, by disabling check.

Allthough, frustrating at first, I am very glad to have run into this issue, because disabling all run time checks (-check none) has created a substantial performace gain, which is crucial to my application.

This decieving part here was that the manual states that check is disabled by default, which apparently its not. Thanks for the help.
0 Kudos
Steven_L_Intel1
Employee
2,225 Views
Yes, -check is disabled by default. But there are two different ways of spelling it and if you used -C then you also enabled all checking.
0 Kudos
Micah_S_
Beginner
2,225 Views
Ok, this makes sense. I had the -C option, and didn't even realize what it was doing.
Thank you - this was very helpful.
0 Kudos
Reply