Skip to content

Commit 634af4d

Browse files
committed
added compiler directives to eliminate gfortran bug workarounds on other compilers.
1 parent 7e0bf0f commit 634af4d

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/json_value_module.F90

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4724,8 +4724,10 @@ recursive subroutine parse_value(json, unit, str, value)
47244724

47254725
logical(LK) :: eof
47264726
character(kind=CK,len=1) :: c
4727+
#if defined __GFORTRAN__
47274728
character(kind=CK,len=:),allocatable :: tmp !! this is a work-around for a bug
47284729
!! in the gfortran 4.9 compiler.
4730+
#endif
47294731

47304732
if (.not. json%exception_thrown) then
47314733

@@ -4766,9 +4768,13 @@ recursive subroutine parse_value(json, unit, str, value)
47664768

47674769
select case (value%var_type)
47684770
case (json_string)
4769-
call json%parse_string(unit, str, tmp) !write to a tmp variable because of
4770-
value%str_value = tmp ! a bug in 4.9 gfortran compiler.
4771-
deallocate(tmp) !
4771+
#if defined __GFORTRAN__
4772+
call json%parse_string(unit,str,tmp) ! write to a tmp variable because of
4773+
value%str_value = tmp ! a bug in 4.9 gfortran compiler.
4774+
deallocate(tmp) !
4775+
#else
4776+
call json%parse_string(unit, str, value%str_value)
4777+
#endif
47724778
end select
47734779

47744780
case (CK_'t') !true_str(1:1) gfortran bug work around
@@ -5343,8 +5349,10 @@ recursive subroutine parse_object(json, unit, str, parent)
53435349
type(json_value),pointer :: pair
53445350
logical(LK) :: eof
53455351
character(kind=CK,len=1) :: c
5352+
#if defined __GFORTRAN__
53465353
character(kind=CK,len=:),allocatable :: tmp !! this is a work-around for a bug
53475354
!! in the gfortran 4.9 compiler.
5355+
#endif
53485356

53495357
if (.not. json%exception_thrown) then
53505358

@@ -5366,9 +5374,13 @@ recursive subroutine parse_object(json, unit, str, parent)
53665374
return
53675375
else if (quotation_mark == c) then
53685376
call json_value_create(pair)
5369-
call json%parse_string(unit, str, tmp) !write to a tmp variable because of
5370-
pair % name = tmp ! a bug in 4.9 gfortran compiler.
5377+
#if defined __GFORTRAN__
5378+
call json%parse_string(unit,str,tmp) ! write to a tmp variable because of
5379+
pair%name = tmp ! a bug in 4.9 gfortran compiler.
53715380
deallocate(tmp)
5381+
#else
5382+
call json%parse_string(unit,str,pair%name)
5383+
#endif
53725384
if (json%exception_thrown) then
53735385
call json%destroy(pair)
53745386
return

0 commit comments

Comments
 (0)