- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In an application that I put together recently I utilised the allocatable argument feature in a function call but forgot to create an explicit interface in the calling program unit. I initially used the debug configuration during the development stage and the program seemed to behave perfectly well however when I compiled the Release configuration it crashed in the function at the point where it called
if(allocated(files)) deallocate(files) where files is the allocatable argument.
I cured the problem by putting the function in a module so that the interface is defined by the module. I am curious as to why it should work in Debug but not in Release and why the compiler can't detect such cases where allocatable arguments have no interfaces defined.
Thanks
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The compiler can detect this with the Generated Interface Checking feature, on by default in a new Debug configuration (as of 10.1). It does require that the called routine be compiled first (if in a separate source). If you have a small example that demonstrates this not working I'd like to see it.
Here's an example:
[fortran]
integer, allocatable :: x(:)
call sub (x)
print *, x
end
subroutine sub (y)
integer, allocatable :: y(:)
allocate (y(3))
y = 4
end
[/fortran]
[plain]
C:\Projects>ifort /warn:interface t.f90
Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 1
3.1.1.171 Build 20130313
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
t.f90(2): error #8055: The procedure has a dummy argument that has the ALLOCATABLE, ASYNCHRONOUS, OPTIONAL, POINTER, TARGET, VALUE or VOLATILE attribute. Required explicit interface is missing from original source.
call sub (x)
----------^
compilation aborted for t.f90 (code 1)
[/plain]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How very odd. My experiments show that subroutines get the message but functions don't. Thanks - we'll look into this. Issue ID is DPD200242997.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A fix has been found for this issue. We are planning to include it in the next major release which is currently scheduled for later this year.

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