Fixes are available
January 2011 PTF for XL Fortran for AIX, V13.1
March 2011 PTF for XL Fortran for AIX, V13.1
August 2011 PTF for XL Fortran for AIX, V13.1
January 2012 PTF for XL Fortran for AIX, V13.1
April 2012 PTF for XL Fortran for AIX, V13.1
July 2012 PTF for XL Fortran for AIX, V13.1
October 2012 PTF for XL Fortran for AIX, V13.1
February 2013 PTF for XL Fortran for AIX, V13.1
May 2013 PTF for XL Fortran for AIX, V13.1
XL Fortran for AIX Fix Pack 15 (August 2013 PTF) for 13.1
XL Fortran for AIX Fix Pack 16 (November 2013 PTF) for 13.1
XL Fortran for AIX Fix Pack 17 (February 2014 PTF) for 13.1
XL Fortran for AIX Fix Pack 21 (April 2015 PTF) for 13.1
XL Fortran for AIX Fix Pack 22 (September 2015 PTF) for 13.1
XL Fortran for AIX Fix Pack 23 (March 2016 PTF) for 13.1
XL Fortran for AIX Fix Pack 24 (September 2016 PTF) for 13.1
APAR status
Closed as program error.
Error description
A deallocation error is encountered during the following situation: From a Fortran routine, data is allocated. c_loc is used to get a C-pointer to point to that data, which is passed to the C-layer. That C-pointer is passed back to a second Fortran routine. The deallocation of this second Fortran pointer is what causes this error to occur. write(0,*) "zz=",zz cptr = c_loc(zz) ! ! pass cptr to C-layer ! ! ----------8<----------8<---------- ! ! subroutine fortran2(cptr) ! call c_f_pointer(cptr, xy) ! xy => zz write(0,*) "xy=",xy So zz is a local Fortran pointer in the first routine, and xy is another local Fortran pointer in the second routine. ===== Test Case: program c_ptr_test use iso_c_binding implicit none type(c_ptr) :: cptr real*8, pointer :: zz, xy write(0,*) 'Allocate zz' allocate(zz) zz=5.d0 write(0,*) "zz=",zz cptr = c_loc(zz) call c_f_pointer(cptr, xy) ! xy => zz write(0,*) "xy=",xy write(0,*) "Deallocate xy" deallocate(xy) end program c_ptr_test ============================== When this test case is compiled using XL Fortran V13.1 on AIX, the following message is observed. $ xlf90 c_ptr_test.f90 $ ./a.out Allocate zz zz= 5.00000000000000000 xy= 5.00000000000000000 Deallocate xy "c_ptr_test.f90", line 15: 1525-109 Error encountered while attempting to deallocate a data object. The program will stop. $
Local fix
N/A.
Problem summary
PROBLEM DESCRIPTION: Information about the permissibility of passing a pointer to deallocate is lost after passing the pointer through C_PTR. USERS AFFECTED: Fortran users passing c_ptr pointers through bind(c) and back into a fortran pointer.
Problem conclusion
Several workarounds were identified for this situation, but it is best to address this issue in your source. if this is not an option, please contact IBM support for a workaround that switches the default behaviour of c_ptr.
Temporary fix
Comments
APAR Information
APAR number
IZ84114
Reported component name
XL FORTRAN FOR
Reported component ID
5724X1500
Reported release
D10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2010-08-31
Closed date
2011-01-03
Last modified date
2011-01-05
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
XL FORTRAN FOR
Fixed component ID
5724X1500
Applicable component levels
RD10 PSY U840772
UP C
Document Information
Modified date:
05 January 2011