@@ -1015,6 +1015,9 @@ subroutine json_info_by_path(json,p,path,found,var_type,n_children,name)
10151015
10161016 type (json_value),pointer :: p_var
10171017 logical (LK) :: ok
1018+ #if defined __GFORTRAN__
1019+ character (kind= CK,len= :),allocatable :: p_name
1020+ #endif
10181021
10191022 call json% get(p,path,p_var,found)
10201023
@@ -1031,7 +1034,21 @@ subroutine json_info_by_path(json,p,path,found,var_type,n_children,name)
10311034 if (present (name)) name = ' '
10321035 else
10331036 ! get info:
1037+
1038+ #if defined __GFORTRAN__
1039+ call json% info(p_var,var_type,n_children)
1040+ if (present (name)) then ! workaround for gfortran bug
1041+ if (allocated (p_var% name)) then
1042+ p_name = p_var% name
1043+ name = p_name
1044+ else
1045+ name = ' '
1046+ end if
1047+ end if
1048+ #else
10341049 call json% info(p_var,var_type,n_children,name)
1050+ #endif
1051+
10351052 end if
10361053
10371054 end subroutine json_info_by_path
@@ -1111,17 +1128,20 @@ subroutine json_matrix_info(json,p,is_matrix,var_type,n_sets,set_size,name)
11111128 integer :: i ! ! counter
11121129 integer :: j ! ! counter
11131130#if defined __GFORTRAN__
1114- character (kind= CK,len= :),allocatable :: p_name ! ! for getting the name
1131+ character (kind= CK,len= :),allocatable :: p_name
11151132#endif
11161133
11171134 ! get info about the variable:
11181135#if defined __GFORTRAN__
1119- ! [note: passing name directory to this routine seems
1120- ! to have a bug on gfortran 6.1.0, so we use a
1121- ! temp variable]
1122- call json% info(p,vartype,nr,p_name)
1123- if (present (name)) name = p_name
1124- if (allocated (p_name)) deallocate (p_name)
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
11251145#else
11261146 call json% info(p,vartype,nr,name)
11271147#endif
@@ -1228,6 +1248,9 @@ subroutine json_matrix_info_by_path(json,p,path,is_matrix,found,&
12281248
12291249 type (json_value),pointer :: p_var
12301250 logical (LK) :: ok
1251+ #if defined __GFORTRAN__
1252+ character (kind= CK,len= :),allocatable :: p_name
1253+ #endif
12311254
12321255 call json% get(p,path,p_var,found)
12331256
@@ -1246,7 +1269,19 @@ subroutine json_matrix_info_by_path(json,p,path,is_matrix,found,&
12461269 else
12471270
12481271 ! 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
12491283 call json% matrix_info(p_var,is_matrix,var_type,n_sets,set_size,name)
1284+ #endif
12501285 if (json% failed() .and. present (found)) then
12511286 found = .false.
12521287 call json% clear_exceptions()
0 commit comments