Skip to content

Commit 354f3f1

Browse files
committed
Gfortran call abort() ==> error stop
Replace compiler extension `abort()` calls with standard Fortran `error stop` statements. Fixes #239
1 parent 76c4492 commit 354f3f1

File tree

6 files changed

+46
-49
lines changed

6 files changed

+46
-49
lines changed

src/tests/unit/send-get/get_array_test.f90

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ subroutine one(lb1, lb2)
4242
end if
4343
sync all
4444
if(this_image()==1) then
45-
if(any (a /= c)) call abort()
45+
if(any (a /= c)) error stop "ARRAY = SCALAR failed in get_array_test"
4646
endif
4747

4848
! Whole array: ARRAY = ARRAY
@@ -59,7 +59,7 @@ subroutine one(lb1, lb2)
5959
print *, a
6060
print *, c
6161
! FIXME: Without the print lines above, it always fails. Why?
62-
call abort()
62+
error stop "ARRAY = ARRAY failed in get_array_test"
6363
end if
6464
endif
6565

@@ -98,7 +98,7 @@ subroutine one(lb1, lb2)
9898
print *, this_image(), ': ', a
9999
print *, this_image(), ': ', c
100100
! FIXME: Without the print lines above, it always fails. Why?
101-
call abort()
101+
error stop "scalar assignment failed in get_array_test"
102102
end if
103103
endif
104104
! Array sections with different ranges and pos/neg strides
@@ -130,7 +130,7 @@ subroutine one(lb1, lb2)
130130
print *, a
131131
print *, c
132132
print *, a-c
133-
call abort()
133+
error stop "array sections with ranges and strides failed in get_array_test"
134134
endif
135135
end if
136136
! ARRAY = ARRAY
@@ -155,7 +155,7 @@ subroutine one(lb1, lb2)
155155
print *, a
156156
print *, c
157157
print *, a-c
158-
call abort()
158+
error stop "array sections with ranges and strides failed in get_array_test"
159159
endif
160160
end if
161161
end do
@@ -189,7 +189,7 @@ subroutine two()
189189
sync all
190190
if (this_image() == num_images()) then
191191
if (any (a /= caf)) &
192-
call abort()
192+
error stop "Array = scalar failed in subroutine two get_array_test"
193193
end if
194194

195195
! Whole array: ARRAY = ARRAY
@@ -203,7 +203,7 @@ subroutine two()
203203
sync all
204204
if (this_image() == num_images()) then
205205
if (any (a /= caf)) &
206-
call abort()
206+
error stop "Array = array failed in subroutine two get_array_test"
207207
end if
208208

209209
! Scalar assignment
@@ -235,7 +235,7 @@ subroutine two()
235235
sync all
236236
if (this_image() == num_images()) then
237237
if (any (a /= caf)) &
238-
call abort()
238+
error stop "scalar assignment failed in subroutine two get_array_test"
239239
end if
240240

241241
! Array sections with different ranges and pos/neg strides
@@ -280,7 +280,7 @@ subroutine two()
280280
print *, a
281281
print *, caf
282282
print *, a-caf
283-
call abort()
283+
error stop "arrays with ranges and strides failed sub. two get_array_test failed"
284284
endif
285285
end if
286286
end do
@@ -314,7 +314,7 @@ subroutine three()
314314
sync all
315315
if (this_image() == num_images()) then
316316
if (any (a /= caf)) &
317-
call abort()
317+
error stop "Array = scalar subroutine three get_array_test failed"
318318
end if
319319

320320
! Whole array: ARRAY = ARRAY
@@ -328,7 +328,7 @@ subroutine three()
328328
sync all
329329
if (this_image() == num_images()) then
330330
if (any (a /= caf)) &
331-
call abort()
331+
error stop "Array = array subroutine three get_array_test failed"
332332
end if
333333

334334
! Scalar assignment
@@ -360,7 +360,7 @@ subroutine three()
360360
sync all
361361
if (this_image() == num_images()) then
362362
if (any (a /= caf)) &
363-
call abort()
363+
error stop "scalar assignment subroutine three get_array_test failed"
364364
end if
365365

366366
! Array sections with different ranges and pos/neg strides
@@ -405,7 +405,7 @@ subroutine three()
405405
print *, a
406406
print *, caf
407407
print *, a-caf
408-
call abort()
408+
error stop "range stride in subroutine three get_array_test failed"
409409
endif
410410
end if
411411
end do

src/tests/unit/send-get/get_with_offset_1d.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ program get_offset_1d
2323

2424
if(me == 1) then
2525
do i=1,10
26-
if(b(i) /= 20+i+me+1) call abort()
26+
if(b(i) /= 20+i+me+1) error stop "get offset 1d failed"
2727
enddo
28-
write(*,*) 'Test passed.'
2928
endif
30-
sync all
29+
sync all
30+
if(me ==1) write(*,*) 'Test passed.'
3131
end program

src/tests/unit/send-get/old_get_array_test.f90

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ subroutine one(lb1, lb2)
4545
if (any (a /= b(lb1,lb2))) then
4646
! FIXME: ABORTS UNLESS THERE IS SOME OTHER CODE
4747
print *, 'HELLO!!!!!!!!!!!!!!!!!'
48-
call abort()
48+
error stop
4949
end if
5050
end if
5151

@@ -63,7 +63,7 @@ subroutine one(lb1, lb2)
6363
print *, a
6464
print *, b
6565
print *, 'WRONG:', any (a /= b)
66-
call abort()
66+
error stop
6767
end if
6868
end if
6969

@@ -114,7 +114,7 @@ subroutine one(lb1, lb2)
114114
! print *, a
115115
! print *, caf
116116
! print *, a-caf
117-
! call abort()
117+
! error stop
118118
! endif
119119
end if
120120
end do
@@ -152,7 +152,7 @@ subroutine two()
152152
sync all
153153
if (this_image() == 1) then
154154
if (any (a /= b)) &
155-
call abort()
155+
error stop
156156
end if
157157

158158
! Whole array: ARRAY = ARRAY
@@ -170,7 +170,7 @@ subroutine two()
170170
sync all
171171
if (this_image() == 1) then
172172
if (any (a /= b)) &
173-
call abort()
173+
error stop
174174
end if
175175

176176
! Array sections with different ranges and pos/neg strides
@@ -221,7 +221,7 @@ subroutine two()
221221
! print *, a
222222
! print *, caf
223223
! print *, a-caf
224-
! call abort()
224+
! error stop
225225
! endif
226226
end if
227227
end do
@@ -259,7 +259,7 @@ subroutine three()
259259
sync all
260260
if (this_image() == 1) then
261261
if (any (a /= b)) &
262-
call abort()
262+
error stop
263263
end if
264264

265265
! Whole array: ARRAY = ARRAY
@@ -277,7 +277,7 @@ subroutine three()
277277
sync all
278278
if (this_image() == 1) then
279279
if (any (a /= b)) &
280-
call abort()
280+
error stop
281281
end if
282282

283283
! Array sections with different ranges and pos/neg strides
@@ -329,7 +329,7 @@ subroutine three()
329329
! print *, a
330330
! print *, caf
331331
! print *, a-caf
332-
! call abort()
332+
! error stop
333333
! endif
334334
end if
335335
end do

src/tests/unit/send-get/send_array_test.f90

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ subroutine one(lb1, lb2)
4242
sync all
4343
if (this_image() == num_images()) then
4444
if (any (a /= caf)) &
45-
call abort()
45+
error stop
4646
end if
4747

4848
! Whole array: ARRAY = ARRAY
@@ -56,7 +56,7 @@ subroutine one(lb1, lb2)
5656
sync all
5757
if (this_image() == num_images()) then
5858
if (any (a /= caf)) &
59-
call abort()
59+
error stop
6060
end if
6161

6262
! Scalar assignment
@@ -88,7 +88,7 @@ subroutine one(lb1, lb2)
8888
sync all
8989
if (this_image() == num_images()) then
9090
if (any (a /= caf)) &
91-
call abort()
91+
error stop
9292
end if
9393

9494
! Array sections with different ranges and pos/neg strides
@@ -133,7 +133,7 @@ subroutine one(lb1, lb2)
133133
print *, a
134134
print *, caf
135135
print *, a-caf
136-
call abort()
136+
error stop
137137
endif
138138
end if
139139
end do
@@ -167,7 +167,7 @@ subroutine two()
167167
sync all
168168
if (this_image() == num_images()) then
169169
if (any (a /= caf)) &
170-
call abort()
170+
error stop
171171
end if
172172

173173
! Whole array: ARRAY = ARRAY
@@ -181,7 +181,7 @@ subroutine two()
181181
sync all
182182
if (this_image() == num_images()) then
183183
if (any (a /= caf)) &
184-
call abort()
184+
error stop
185185
end if
186186

187187
! Scalar assignment
@@ -213,7 +213,7 @@ subroutine two()
213213
sync all
214214
if (this_image() == num_images()) then
215215
if (any (a /= caf)) &
216-
call abort()
216+
error stop
217217
end if
218218

219219
! Array sections with different ranges and pos/neg strides
@@ -258,7 +258,7 @@ subroutine two()
258258
print *, a
259259
print *, caf
260260
print *, a-caf
261-
call abort()
261+
error stop
262262
endif
263263
end if
264264
end do
@@ -292,7 +292,7 @@ subroutine three()
292292
sync all
293293
if (this_image() == num_images()) then
294294
if (any (a /= caf)) &
295-
call abort()
295+
error stop
296296
end if
297297

298298
! Whole array: ARRAY = ARRAY
@@ -306,7 +306,7 @@ subroutine three()
306306
sync all
307307
if (this_image() == num_images()) then
308308
if (any (a /= caf)) &
309-
call abort()
309+
error stop
310310
end if
311311

312312
! Scalar assignment
@@ -338,7 +338,7 @@ subroutine three()
338338
sync all
339339
if (this_image() == num_images()) then
340340
if (any (a /= caf)) &
341-
call abort()
341+
error stop
342342
end if
343343

344344
! Array sections with different ranges and pos/neg strides
@@ -383,7 +383,7 @@ subroutine three()
383383
print *, a
384384
print *, caf
385385
print *, a-caf
386-
call abort()
386+
error stop
387387
endif
388388
end if
389389
end do

src/tests/unit/send-get/strided_get.f90

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ program strided_get
1818

1919
if(me == 2) then
2020
bc(1:2,:,:,:) = ac(0:1,:,:,:)[me-1]
21-
if(any(bc(1:2,:,:,:) /= 1)) call abort()
22-
write(*,*) 'Test passed.'
21+
if(any(bc(1:2,:,:,:) /= 1)) error stop "strided get test failed"
2322
endif
2423

24+
sync all
25+
26+
if (me == 2) write(*,*) 'Test passed.'
2527
end program

src/tests/unit/send-get/whole_get_array.f90

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ program whole_array_get
2020
if(me == 1) then
2121
y1 = x1(:)[me+1]
2222
if(any(y1 /= 2)) then
23-
write(*,*) 'Test 1 fails'
24-
call abort()
23+
error stop 'Test 1 fails'
2524
end if
2625
end if
2726

@@ -35,8 +34,7 @@ program whole_array_get
3534
if(me == 1) then
3635
y2 = x2(:,:)[np]
3736
if(any(y2 /= np)) then
38-
write(*,*) 'Test 2 fails'
39-
call abort()
37+
error stop 'Test 2 fails'
4038
end if
4139
end if
4240

@@ -49,8 +47,7 @@ program whole_array_get
4947
if(me == 1) then
5048
y1 = x2(:,n/2)[me+1]
5149
if(any(y1 /= 2+n/2)) then
52-
write(*,*) 'Test 3 fails'
53-
call abort()
50+
error stop 'Test 3 fails'
5451
end if
5552
end if
5653

@@ -64,8 +61,7 @@ program whole_array_get
6461
if(me == 1) then
6562
y3 = x3(:,:,:)[me+1]
6663
if(any(y3 /= me+1)) then
67-
write(*,*) 'Test 4 fails'
68-
call abort()
64+
error stop 'Test 4 fails'
6965
end if
7066
endif
7167

@@ -79,8 +75,7 @@ program whole_array_get
7975
if(me == 1) then
8076
y3(:,n/2,:) = x3(:,:,n/2)[me+1]
8177
if(any(y3(:,n/2,:) /= me+1+n/2)) then
82-
write(*,*) 'Test 5 fails'
83-
call abort()
78+
error stop 'Test 5 fails'
8479
end if
8580
endif
8681

0 commit comments

Comments
 (0)