Skip to content

Commit 7cb102c

Browse files
committed
revert previous commit. this workaround is necessary for unicode build with gfortran-4.9
1 parent 9175258 commit 7cb102c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/json_value_module.F90

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,9 +1127,24 @@ subroutine json_matrix_info(json,p,is_matrix,var_type,n_sets,set_size,name)
11271127
integer(IK) :: icount !! number of elements in a set
11281128
integer :: i !! counter
11291129
integer :: j !! counter
1130+
#if defined __GFORTRAN__
1131+
character(kind=CK,len=:),allocatable :: p_name
1132+
#endif
11301133

11311134
!get info about the variable:
1135+
#if defined __GFORTRAN__
1136+
call json%info(p,vartype,nr)
1137+
if (present(name)) then !workaround for gfortran bug
1138+
if (allocated(p%name)) then
1139+
p_name = p%name
1140+
name = p_name
1141+
else
1142+
name = ''
1143+
end if
1144+
end if
1145+
#else
11321146
call json%info(p,vartype,nr,name)
1147+
#endif
11331148

11341149
is_matrix = (vartype==json_array)
11351150

@@ -1233,6 +1248,9 @@ subroutine json_matrix_info_by_path(json,p,path,is_matrix,found,&
12331248

12341249
type(json_value),pointer :: p_var
12351250
logical(LK) :: ok
1251+
#if defined __GFORTRAN__
1252+
character(kind=CK,len=:),allocatable :: p_name
1253+
#endif
12361254

12371255
call json%get(p,path,p_var,found)
12381256

@@ -1251,7 +1269,19 @@ subroutine json_matrix_info_by_path(json,p,path,is_matrix,found,&
12511269
else
12521270

12531271
!get info about the variable:
1272+
#if defined __GFORTRAN__
1273+
call json%matrix_info(p_var,is_matrix,var_type,n_sets,set_size)
1274+
if (present(name)) then !workaround for gfortran bug
1275+
if (allocated(p_var%name)) then
1276+
p_name = p_var%name
1277+
name = p_name
1278+
else
1279+
name = ''
1280+
end if
1281+
end if
1282+
#else
12541283
call json%matrix_info(p_var,is_matrix,var_type,n_sets,set_size,name)
1284+
#endif
12551285
if (json%failed() .and. present(found)) then
12561286
found = .false.
12571287
call json%clear_exceptions()

0 commit comments

Comments
 (0)