Skip to content

Commit 0f8de26

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 5c4f6ab commit 0f8de26

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

src/Infrastructure/Container/tests/ESMF_ContainerUTest.F90

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ program ESMF_ContainerUTest
8181
integer :: garbageCount, itemCount
8282
logical :: isPresent, loopResult
8383
type(TestType) :: tt
84-
84+
type(TestTypeStruct), pointer :: wrap
85+
8586
!-------------------------------------------------------------------------------
8687
! The unit tests are divided into Sanity and Exhaustive. The Sanity tests are
8788
! always run. When the environment variable, EXHAUSTIVE, is set to ON then
@@ -1100,7 +1101,8 @@ program ESMF_ContainerUTest
11001101
loopResult = .false.
11011102
exit
11021103
endif
1103-
deallocate(tt%wrap, stat=stat)
1104+
wrap => tt%wrap ! LLVM workaround for deallocate() runtime error!
1105+
deallocate(wrap, stat=stat)
11041106
if (stat/=0) then
11051107
loopResult = .false.
11061108
exit

src/Superstructure/InternalState/examples/ESMF_InternalStateEx.F90

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ program ESMF_InternalStateEx
5454
end type
5555

5656
type(dataWrapper) :: wrap
57+
type(testData), pointer :: p
5758
character(len=:), allocatable :: labelList(:)
5859
!EOC
5960
integer :: result
@@ -129,7 +130,8 @@ program ESMF_InternalStateEx
129130
endif
130131

131132
! Deallocate the private data block
132-
deallocate(wrap%p)
133+
p => wrap%p ! LLVM workaround for deallocate() runtime error!
134+
deallocate(p)
133135

134136
!EOC
135137
!-------------------------------------------------------------------------
@@ -192,15 +194,17 @@ program ESMF_InternalStateEx
192194
if (rc .ne. ESMF_SUCCESS) finalrc = ESMF_FAILURE
193195

194196
! Deallocate the private data block
195-
deallocate(wrap%p)
197+
p => wrap%p ! LLVM workaround for deallocate() runtime error!
198+
deallocate(p)
196199

197200
! Get Internal State
198201
call ESMF_InternalStateGet(comp, internalState=wrap, &
199202
label="second named data block", rc=rc)
200203
if (rc .ne. ESMF_SUCCESS) finalrc = ESMF_FAILURE
201204

202205
! Deallocate the private data block
203-
deallocate(wrap%p)
206+
p => wrap%p ! LLVM workaround for deallocate() runtime error!
207+
deallocate(p)
204208

205209
!EOC
206210

src/Superstructure/InternalState/tests/ESMF_InternalStateUTest.F90

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ program ESMF_InternalStateUTest
5555
end type
5656

5757
type(dataWrapper) :: wrapAdd, wrapGet
58+
type(testData), pointer :: p
5859
character(len=:), allocatable :: labelList(:)
5960
logical :: isValid
6061

@@ -232,7 +233,8 @@ program ESMF_InternalStateUTest
232233
call ESMF_Test((isValid), name, failMsg, result, ESMF_SRCLINE)
233234

234235
! deallocate InternalState data
235-
deallocate(wrapGet%p)
236+
p => wrapGet%p ! LLVM workaround for deallocate() runtime error!
237+
deallocate(p)
236238

237239
!------------------------------------------------------------------------
238240
!NEX_UTest
@@ -250,7 +252,8 @@ program ESMF_InternalStateUTest
250252
call ESMF_Test((isValid), name, failMsg, result, ESMF_SRCLINE)
251253

252254
! deallocate InternalState data
253-
deallocate(wrapGet%p)
255+
p => wrapGet%p ! LLVM workaround for deallocate() runtime error!
256+
deallocate(p)
254257

255258
!------------------------------------------------------------------------
256259
!NEX_UTest
@@ -268,7 +271,8 @@ program ESMF_InternalStateUTest
268271
call ESMF_Test((isValid), name, failMsg, result, ESMF_SRCLINE)
269272

270273
! deallocate InternalState data
271-
deallocate(wrapGet%p)
274+
p => wrapGet%p ! LLVM workaround for deallocate() runtime error!
275+
deallocate(p)
272276

273277
!------------------------------------------------------------------------
274278
!NEX_UTest

0 commit comments

Comments
 (0)