Skip to content

Commit 33464e4

Browse files
committed
More places for the LLVM workaround when dealing with Fortran pointers
inside Fortran derived types that are handed through the C/C++ layer.
1 parent f3163fb commit 33464e4

File tree

4 files changed

+28
-16
lines changed

4 files changed

+28
-16
lines changed

src/system_tests/ESMF_ConcurrentEnsemble/user_modelA.F90

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,21 @@ subroutine user_final(comp, importState, exportState, clock, rc)
201201
type(ESMF_State) :: importState, exportState
202202
type(ESMF_Clock) :: clock
203203
integer, intent(out) :: rc
204-
type(dataWrapper) :: intStatePtr
205204

206205
! Local variables
207-
type(ESMF_DistGrid) :: distgrid
208-
type(ESMF_Array) :: array
206+
type(dataWrapper) :: intStatePtr
207+
type(dblock), pointer :: p
208+
type(ESMF_DistGrid) :: distgrid
209+
type(ESMF_Array) :: array
209210

210211
! Initialize return code
211212
rc = ESMF_SUCCESS
212213

213214
call ESMF_GridCompGetInternalState(comp, intStatePtr, rc)
214215
if (rc/=ESMF_SUCCESS) return ! bail out
215-
deallocate(intStatePtr%p)
216+
217+
p => intStatePtr%p ! LLVM workaround for deallocate() runtime error!
218+
deallocate(p)
216219

217220
call ESMF_StateGet(exportState, "array data", array, rc=rc)
218221
if (rc/=ESMF_SUCCESS) return ! bail out

src/system_tests/ESMF_ConcurrentEnsemble/user_modelB.F90

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,21 @@ subroutine user_final(comp, importState, exportState, clock, rc)
205205
type(ESMF_State) :: importState, exportState
206206
type(ESMF_Clock) :: clock
207207
integer, intent(out) :: rc
208-
type(dataWrapper) :: intStatePtr
209208

210209
! Local variables
211-
type(ESMF_DistGrid) :: distgrid
212-
type(ESMF_Array) :: array
210+
type(dataWrapper) :: intStatePtr
211+
type(dblock), pointer :: p
212+
type(ESMF_DistGrid) :: distgrid
213+
type(ESMF_Array) :: array
213214

214215
! Initialize return code
215216
rc = ESMF_SUCCESS
216217

217218
call ESMF_GridCompGetInternalState(comp, intStatePtr, rc)
218219
if (rc/=ESMF_SUCCESS) return ! bail out
219-
deallocate(intStatePtr%p)
220+
221+
p => intStatePtr%p ! LLVM workaround for deallocate() runtime error!
222+
deallocate(p)
220223

221224
call ESMF_StateGet(exportState, "array data", array, rc=rc)
222225
if (rc/=ESMF_SUCCESS) return ! bail out

src/system_tests/ESMF_SequentialEnsemble/user_modelA.F90

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,21 @@ subroutine user_final(comp, importState, exportState, clock, rc)
201201
type(ESMF_State) :: importState, exportState
202202
type(ESMF_Clock) :: clock
203203
integer, intent(out) :: rc
204-
type(dataWrapper) :: intStatePtr
205204

206205
! Local variables
207-
type(ESMF_DistGrid) :: distgrid
208-
type(ESMF_Array) :: array
206+
type(dataWrapper) :: intStatePtr
207+
type(dblock), pointer :: p
208+
type(ESMF_DistGrid) :: distgrid
209+
type(ESMF_Array) :: array
209210

210211
! Initialize return code
211212
rc = ESMF_SUCCESS
212213

213214
call ESMF_GridCompGetInternalState(comp, intStatePtr, rc)
214215
if (rc/=ESMF_SUCCESS) return ! bail out
215-
deallocate(intStatePtr%p)
216+
217+
p => intStatePtr%p ! LLVM workaround for deallocate() runtime error!
218+
deallocate(p)
216219

217220
call ESMF_StateGet(exportState, "array data", array, rc=rc)
218221
if (rc/=ESMF_SUCCESS) return ! bail out

src/system_tests/ESMF_SequentialEnsemble/user_modelB.F90

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,21 @@ subroutine user_final(comp, importState, exportState, clock, rc)
205205
type(ESMF_State) :: importState, exportState
206206
type(ESMF_Clock) :: clock
207207
integer, intent(out) :: rc
208-
type(dataWrapper) :: intStatePtr
209208

210209
! Local variables
211-
type(ESMF_DistGrid) :: distgrid
212-
type(ESMF_Array) :: array
210+
type(dataWrapper) :: intStatePtr
211+
type(dblock), pointer :: p
212+
type(ESMF_DistGrid) :: distgrid
213+
type(ESMF_Array) :: array
213214

214215
! Initialize return code
215216
rc = ESMF_SUCCESS
216217

217218
call ESMF_GridCompGetInternalState(comp, intStatePtr, rc)
218219
if (rc/=ESMF_SUCCESS) return ! bail out
219-
deallocate(intStatePtr%p)
220+
221+
p => intStatePtr%p ! LLVM workaround for deallocate() runtime error!
222+
deallocate(p)
220223

221224
call ESMF_StateGet(exportState, "array data", array, rc=rc)
222225
if (rc/=ESMF_SUCCESS) return ! bail out

0 commit comments

Comments
 (0)