Skip to content

Commit 197d3e5

Browse files
committed
Fixed a few more non-default integer kind issues that might trigger errors depending on the compiler flags. See #365
1 parent db67dc9 commit 197d3e5

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

src/json_value_module.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2719,7 +2719,7 @@ recursive subroutine check_if_valid(p,require_parent)
27192719
logical,intent(in) :: require_parent !! the first one may be a root (so no parent),
27202720
!! but all descendants must have a parent.
27212721

2722-
integer :: i !! counter
2722+
integer(IK) :: i !! counter
27232723
type(json_value),pointer :: element
27242724
type(json_value),pointer :: previous
27252725

@@ -2833,7 +2833,7 @@ recursive subroutine check_if_valid(p,require_parent)
28332833

28342834
previous => null()
28352835
element => p%children
2836-
do i = 1, p%n_children
2836+
do i = 1_IK, p%n_children
28372837
if (.not. associated(element%parent,p)) then
28382838
error_msg = 'child''s parent pointer not properly associated'
28392839
is_valid = .false.

src/tests/jf_test_12.F90

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ subroutine test_12(error_cnt)
2626

2727
integer,intent(out) :: error_cnt !! report number of errors to caller
2828

29-
integer,parameter :: imx = 5, jmx = 3, kmx = 4 !! dimensions for raw work array of primitive type
29+
integer(IK),parameter :: imx = 5, jmx = 3, kmx = 4 !! dimensions for raw work array of primitive type
3030

3131
type(json_core) :: json !! factory for manipulating `json_value` pointers
3232
integer(IK),dimension(3) :: shape !! shape of work array
@@ -38,7 +38,7 @@ subroutine test_12(error_cnt)
3838
real(wp) :: array_element
3939
real(wp), dimension(:), allocatable :: fetched_array
4040
character(kind=CK,len=:), allocatable :: description
41-
integer :: i,j,k !! loop indices
41+
integer(IK) :: i,j,k !! loop indices
4242
integer(IK) :: array_length, lun
4343
logical(LK) :: existed
4444
logical(LK), dimension(:), allocatable :: SOS
@@ -54,8 +54,8 @@ subroutine test_12(error_cnt)
5454
write(error_unit,'(A)') ''
5555

5656
! populate the raw array
57-
forall (i=1:imx,j=1:jmx,k=1:kmx) ! could use size(... , dim=...) instead of constants
58-
raw_array(i,j,k) = i + (j-1)*imx + (k-1)*imx*jmx
57+
forall (i=1_IK:imx,j=1_IK:jmx,k=1_IK:kmx) ! could use size(... , dim=...) instead of constants
58+
raw_array(i,j,k) = i + (j-1_IK)*imx + (k-1_IK)*imx*jmx
5959
end forall
6060

6161
call json%create_object(root,dir//file)
@@ -218,13 +218,13 @@ subroutine get_3D_from_array(json, element, i, count)
218218
integer(IK),intent(in) :: i !! index
219219
integer(IK),intent(in) :: count !! size of array
220220

221-
integer :: useless !! assign count to this to silence warnings
221+
integer(IK) :: useless !! assign count to this to silence warnings
222222

223223
! let's pretend we're c programmers!
224224
call json%get( element, raw_array( &
225-
mod(i-1,imx) + 1, & ! i index
226-
mod((i-1)/imx,jmx) + 1, & ! j index
227-
mod((i-1)/imx/jmx,kmx) + 1 ) ) ! k inded
225+
mod(i-1_IK,imx) + 1_IK, & ! i index
226+
mod((i-1_IK)/imx,jmx) + 1_IK, & ! j index
227+
mod((i-1_IK)/imx/jmx,kmx) + 1_IK ) ) ! k inded
228228

229229
useless = count
230230

src/tests/jf_test_15.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ subroutine test_15(error_cnt)
8585
compact_reals=.true.,&
8686
print_signs=.false.,&
8787
real_format='E',&
88-
spaces_per_tab=4,&
88+
spaces_per_tab=4_IK,&
8989
strict_type_checking=.true.,&
9090
trailing_spaces_significant=.false.,&
9191
case_sensitive_keys=.true.)

src/tests/jf_test_32.F90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ subroutine test_32(error_cnt)
2323
integer,intent(out) :: error_cnt
2424
integer :: i !! counter
2525
integer :: j !! counter
26-
integer :: k !! counter
2726
type(json_core) :: json
2827
type(json_value),pointer :: p, p_var
2928
character(kind=CK,len=:),allocatable :: path_ck

0 commit comments

Comments
 (0)