- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
with ifx 2024.0.0 on Windows 10 the following code:
module type_test
implicit none
private
public T_TEST
type T_TEST
integer :: vlist_val
contains
procedure, private :: r_fmt_idc
generic :: read(formatted) => r_fmt_idc
end type
contains
subroutine r_fmt_idc(dtv, unit, iotype, vlist, iostat, iomsg)
class(T_TEST), intent(inout) :: dtv
integer, intent(in) :: unit
character(len=*), intent(in) :: iotype
integer, intent(in) :: vlist(:)
integer, intent(out) :: iostat
character(len=*), intent(inout) :: iomsg
dtv%vlist_val = vlist(1)
iostat = 0
end subroutine
end module type_test
program ifx_001
use type_test
character(len=5) :: s
type(T_TEST) t
read(s, fmt="(DT(5))") t
print *, t%vlist_val
end program
when compiled with
ifx /check:pointer /libs:dll ifx_001.f90
produces this runtime error:
forrtl: severe (408): fort: (7): Attempt to use pointer VLIST when it is not associated with a target
Image PC Routine Line Source
libifcoremd.dll 00007FFDE104E09C Unknown Unknown Unknown
ifx_001.exe 00007FF760311055 Unknown Unknown Unknown
libifcoremd.dll 00007FFDE10CC82D Unknown Unknown Unknown
libifcoremd.dll 00007FFDE10CD529 Unknown Unknown Unknown
libifcoremd.dll 00007FFDE109862F Unknown Unknown Unknown
ifx_001.exe 00007FF7603111B1 Unknown Unknown Unknown
ifx_001.exe 00007FF76031121B Unknown Unknown Unknown
ifx_001.exe 00007FF760311520 Unknown Unknown Unknown
KERNEL32.DLL 00007FFE9BB37344 Unknown Unknown Unknown
ntdll.dll 00007FFE9BD826B1 Unknown Unknown Unknown
Full compiler and Windows version:
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.0 Build 20231017
Windows 10 22H2 Version 10.0.19045.4170
With only one of the compile options the code runs fine. The example code is of course a minimal example, the problem occurs in a large application I am migrating from VS2015/Ifort 18.0 to VS2022/ifx.
The problem does not occur with IFort 18.0.5
Out of curiosity I also compiled with Ifort 2021.11.0 and the problem occurs also
Is this a bug in the runtime or inadequate usage of the options by me ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Barbara,
after reading your post I got the suspicion that something in my setup must be wrong. And actually, using Sysinternal Process Explorer and a read *,s statement to halt my program before the crash, I can see that libifcoremd.dll and libmmd.dll are taken from C:\Program Files (x86) \Intel\oneAPI\intelPython\latest\Library\bin instead of C:\Program Files (x86)\Intel\oneAPI\compiler\2024.0\bin.
I was using the setvars.bat script in C:\Program Files (x86)\Intel\oneAPI which seems not to be the right one. I think this has to do with the new layout of directories introduced with the 2024.0 release (and me not reading all the doc.)
By running the oneapi-vars script from C:\Program Files (x86)\Intel\oneAPI\2024.0 and compiling and running from within that environment, everything works fine.
Thanks for your help!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@johnyb61 wrote:..
Is this a bug in the runtime or inadequate usage of the options by me ?
The latter.
You need to do "defensive programming" here. An option you can consder is to guard the reference to vlist by taking advantage of the fact Fortran allows zero-sized arrays:
if ( size(vlist) > 0 ) then
dtv%vlist_val = vlist(1)
end if
You can also employ the "iotype" received argument for further defensive progrmaming.
Note when the caller consumes the derived-type defined IO with list-directed or namelist formatting, the callee can expect vlist to be treated as zero-sized array.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
But in my example with format DT(5) vlist should not be empty, it should be [5].
When compiled without check:pointer the program prints 5, which is the value of vlist(1) and the expected result.
But with the given compiler options it either becomes empty or the runtime check checks the wrong things.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just to be certain, i tried to use your code and the problem remains because size(vlist) is 1 (as you can see if you add a print *, size(vlist) inside your if block) but then accessing the value of the first element triggers the runtime error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@johnyb61, this is weird. I cannot reproduce your output with the same version of ifx.
Q:\tmp>ifx /check:pointer /libs:dll type_test.f90
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.0 Build 20231017
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 14.38.33130.0
Copyright (C) Microsoft Corporation. All rights reserved.
-out:type_test.exe
-subsystem:console
type_test.obj
Q:\tmp>type_test.exe
5
I'm on Windows 11 with VS 2022 Version 17.8.1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Barbara,
after reading your post I got the suspicion that something in my setup must be wrong. And actually, using Sysinternal Process Explorer and a read *,s statement to halt my program before the crash, I can see that libifcoremd.dll and libmmd.dll are taken from C:\Program Files (x86) \Intel\oneAPI\intelPython\latest\Library\bin instead of C:\Program Files (x86)\Intel\oneAPI\compiler\2024.0\bin.
I was using the setvars.bat script in C:\Program Files (x86)\Intel\oneAPI which seems not to be the right one. I think this has to do with the new layout of directories introduced with the 2024.0 release (and me not reading all the doc.)
By running the oneapi-vars script from C:\Program Files (x86)\Intel\oneAPI\2024.0 and compiling and running from within that environment, everything works fine.
Thanks for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're welcome! I'm glad you found the solution!
Good sleuthing!

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page