Skip to content

Commit b69386c

Browse files
committed
ASSERT_PARALLEL_CALLBACKS: Deploy more safety
Previously with ASSERT_PARALLEL_CALLBACKS feature, we would crash if an assertion failed before the procedure pointers were set. Ensure reasonable behavior for that corner-case.
1 parent 4509eaf commit b69386c

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/assert/assert_subroutine_m.F90

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ pure subroutine assert_always(assertion, description, file, line)
121121

122122
#if ASSERT_MULTI_IMAGE
123123
# if ASSERT_PARALLEL_CALLBACKS
124-
me = assert_this_image()
124+
if (associated(assert_this_image)) then
125+
me = assert_this_image()
126+
else
127+
me = 0
128+
endif
125129
# else
126130
me = this_image()
127131
# endif
@@ -136,10 +140,13 @@ pure subroutine assert_always(assertion, description, file, line)
136140
#endif
137141

138142
#if ASSERT_PARALLEL_CALLBACKS
139-
call assert_error_stop(message)
140-
#else
141-
error stop message, QUIET=.false.
143+
if (associated(assert_this_image)) then
144+
call assert_error_stop(message)
145+
else
146+
; ! deliberate fall-thru
147+
endif
142148
#endif
149+
error stop message, QUIET=.false.
143150

144151
end if check_assertion
145152

0 commit comments

Comments
 (0)