Skip to content

Commit

Permalink
Gfortran call abort() ==> error stop
Browse files Browse the repository at this point in the history
 Replace compiler extension `abort()` calls with standard Fortran `error
 stop` statements.

 Fixes #239
  • Loading branch information
zbeekman committed Nov 3, 2016
1 parent 76c4492 commit 354f3f1
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 49 deletions.
26 changes: 13 additions & 13 deletions src/tests/unit/send-get/get_array_test.f90
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ subroutine one(lb1, lb2)
end if
sync all
if(this_image()==1) then
if(any (a /= c)) call abort()
if(any (a /= c)) error stop "ARRAY = SCALAR failed in get_array_test"
endif

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

Expand Down Expand Up @@ -98,7 +98,7 @@ subroutine one(lb1, lb2)
print *, this_image(), ': ', a
print *, this_image(), ': ', c
! FIXME: Without the print lines above, it always fails. Why?
call abort()
error stop "scalar assignment failed in get_array_test"
end if
endif
! Array sections with different ranges and pos/neg strides
Expand Down Expand Up @@ -130,7 +130,7 @@ subroutine one(lb1, lb2)
print *, a
print *, c
print *, a-c
call abort()
error stop "array sections with ranges and strides failed in get_array_test"
endif
end if
! ARRAY = ARRAY
Expand All @@ -155,7 +155,7 @@ subroutine one(lb1, lb2)
print *, a
print *, c
print *, a-c
call abort()
error stop "array sections with ranges and strides failed in get_array_test"
endif
end if
end do
Expand Down Expand Up @@ -189,7 +189,7 @@ subroutine two()
sync all
if (this_image() == num_images()) then
if (any (a /= caf)) &
call abort()
error stop "Array = scalar failed in subroutine two get_array_test"
end if

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

! Scalar assignment
Expand Down Expand Up @@ -235,7 +235,7 @@ subroutine two()
sync all
if (this_image() == num_images()) then
if (any (a /= caf)) &
call abort()
error stop "scalar assignment failed in subroutine two get_array_test"
end if

! Array sections with different ranges and pos/neg strides
Expand Down Expand Up @@ -280,7 +280,7 @@ subroutine two()
print *, a
print *, caf
print *, a-caf
call abort()
error stop "arrays with ranges and strides failed sub. two get_array_test failed"
endif
end if
end do
Expand Down Expand Up @@ -314,7 +314,7 @@ subroutine three()
sync all
if (this_image() == num_images()) then
if (any (a /= caf)) &
call abort()
error stop "Array = scalar subroutine three get_array_test failed"
end if

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

! Scalar assignment
Expand Down Expand Up @@ -360,7 +360,7 @@ subroutine three()
sync all
if (this_image() == num_images()) then
if (any (a /= caf)) &
call abort()
error stop "scalar assignment subroutine three get_array_test failed"
end if

! Array sections with different ranges and pos/neg strides
Expand Down Expand Up @@ -405,7 +405,7 @@ subroutine three()
print *, a
print *, caf
print *, a-caf
call abort()
error stop "range stride in subroutine three get_array_test failed"
endif
end if
end do
Expand Down
6 changes: 3 additions & 3 deletions src/tests/unit/send-get/get_with_offset_1d.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ program get_offset_1d

if(me == 1) then
do i=1,10
if(b(i) /= 20+i+me+1) call abort()
if(b(i) /= 20+i+me+1) error stop "get offset 1d failed"
enddo
write(*,*) 'Test passed.'
endif
sync all
sync all
if(me ==1) write(*,*) 'Test passed.'
end program
18 changes: 9 additions & 9 deletions src/tests/unit/send-get/old_get_array_test.f90
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ subroutine one(lb1, lb2)
if (any (a /= b(lb1,lb2))) then
! FIXME: ABORTS UNLESS THERE IS SOME OTHER CODE
print *, 'HELLO!!!!!!!!!!!!!!!!!'
call abort()
error stop
end if
end if

Expand All @@ -63,7 +63,7 @@ subroutine one(lb1, lb2)
print *, a
print *, b
print *, 'WRONG:', any (a /= b)
call abort()
error stop
end if
end if

Expand Down Expand Up @@ -114,7 +114,7 @@ subroutine one(lb1, lb2)
! print *, a
! print *, caf
! print *, a-caf
! call abort()
! error stop
! endif
end if
end do
Expand Down Expand Up @@ -152,7 +152,7 @@ subroutine two()
sync all
if (this_image() == 1) then
if (any (a /= b)) &
call abort()
error stop
end if

! Whole array: ARRAY = ARRAY
Expand All @@ -170,7 +170,7 @@ subroutine two()
sync all
if (this_image() == 1) then
if (any (a /= b)) &
call abort()
error stop
end if

! Array sections with different ranges and pos/neg strides
Expand Down Expand Up @@ -221,7 +221,7 @@ subroutine two()
! print *, a
! print *, caf
! print *, a-caf
! call abort()
! error stop
! endif
end if
end do
Expand Down Expand Up @@ -259,7 +259,7 @@ subroutine three()
sync all
if (this_image() == 1) then
if (any (a /= b)) &
call abort()
error stop
end if

! Whole array: ARRAY = ARRAY
Expand All @@ -277,7 +277,7 @@ subroutine three()
sync all
if (this_image() == 1) then
if (any (a /= b)) &
call abort()
error stop
end if

! Array sections with different ranges and pos/neg strides
Expand Down Expand Up @@ -329,7 +329,7 @@ subroutine three()
! print *, a
! print *, caf
! print *, a-caf
! call abort()
! error stop
! endif
end if
end do
Expand Down
24 changes: 12 additions & 12 deletions src/tests/unit/send-get/send_array_test.f90
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ subroutine one(lb1, lb2)
sync all
if (this_image() == num_images()) then
if (any (a /= caf)) &
call abort()
error stop
end if

! Whole array: ARRAY = ARRAY
Expand All @@ -56,7 +56,7 @@ subroutine one(lb1, lb2)
sync all
if (this_image() == num_images()) then
if (any (a /= caf)) &
call abort()
error stop
end if

! Scalar assignment
Expand Down Expand Up @@ -88,7 +88,7 @@ subroutine one(lb1, lb2)
sync all
if (this_image() == num_images()) then
if (any (a /= caf)) &
call abort()
error stop
end if

! Array sections with different ranges and pos/neg strides
Expand Down Expand Up @@ -133,7 +133,7 @@ subroutine one(lb1, lb2)
print *, a
print *, caf
print *, a-caf
call abort()
error stop
endif
end if
end do
Expand Down Expand Up @@ -167,7 +167,7 @@ subroutine two()
sync all
if (this_image() == num_images()) then
if (any (a /= caf)) &
call abort()
error stop
end if

! Whole array: ARRAY = ARRAY
Expand All @@ -181,7 +181,7 @@ subroutine two()
sync all
if (this_image() == num_images()) then
if (any (a /= caf)) &
call abort()
error stop
end if

! Scalar assignment
Expand Down Expand Up @@ -213,7 +213,7 @@ subroutine two()
sync all
if (this_image() == num_images()) then
if (any (a /= caf)) &
call abort()
error stop
end if

! Array sections with different ranges and pos/neg strides
Expand Down Expand Up @@ -258,7 +258,7 @@ subroutine two()
print *, a
print *, caf
print *, a-caf
call abort()
error stop
endif
end if
end do
Expand Down Expand Up @@ -292,7 +292,7 @@ subroutine three()
sync all
if (this_image() == num_images()) then
if (any (a /= caf)) &
call abort()
error stop
end if

! Whole array: ARRAY = ARRAY
Expand All @@ -306,7 +306,7 @@ subroutine three()
sync all
if (this_image() == num_images()) then
if (any (a /= caf)) &
call abort()
error stop
end if

! Scalar assignment
Expand Down Expand Up @@ -338,7 +338,7 @@ subroutine three()
sync all
if (this_image() == num_images()) then
if (any (a /= caf)) &
call abort()
error stop
end if

! Array sections with different ranges and pos/neg strides
Expand Down Expand Up @@ -383,7 +383,7 @@ subroutine three()
print *, a
print *, caf
print *, a-caf
call abort()
error stop
endif
end if
end do
Expand Down
6 changes: 4 additions & 2 deletions src/tests/unit/send-get/strided_get.f90
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ program strided_get

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

sync all

if (me == 2) write(*,*) 'Test passed.'
end program
15 changes: 5 additions & 10 deletions src/tests/unit/send-get/whole_get_array.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ program whole_array_get
if(me == 1) then
y1 = x1(:)[me+1]
if(any(y1 /= 2)) then
write(*,*) 'Test 1 fails'
call abort()
error stop 'Test 1 fails'
end if
end if

Expand All @@ -35,8 +34,7 @@ program whole_array_get
if(me == 1) then
y2 = x2(:,:)[np]
if(any(y2 /= np)) then
write(*,*) 'Test 2 fails'
call abort()
error stop 'Test 2 fails'
end if
end if

Expand All @@ -49,8 +47,7 @@ program whole_array_get
if(me == 1) then
y1 = x2(:,n/2)[me+1]
if(any(y1 /= 2+n/2)) then
write(*,*) 'Test 3 fails'
call abort()
error stop 'Test 3 fails'
end if
end if

Expand All @@ -64,8 +61,7 @@ program whole_array_get
if(me == 1) then
y3 = x3(:,:,:)[me+1]
if(any(y3 /= me+1)) then
write(*,*) 'Test 4 fails'
call abort()
error stop 'Test 4 fails'
end if
endif

Expand All @@ -79,8 +75,7 @@ program whole_array_get
if(me == 1) then
y3(:,n/2,:) = x3(:,:,n/2)[me+1]
if(any(y3(:,n/2,:) /= me+1+n/2)) then
write(*,*) 'Test 5 fails'
call abort()
error stop 'Test 5 fails'
end if
endif

Expand Down

0 comments on commit 354f3f1

Please sign in to comment.