Skip to content

Commit 677345e

Browse files
committed
Added a workaround for a Gfortran 6.1 bug. Fixes #186.
Note that I added a compiler directive so that the workaround is only used when compiling with Gfortran (any version).
1 parent 7d074d0 commit 677345e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/json_string_utilities.F90

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,12 @@ subroutine escape_string(str_in, str_out)
225225
character(kind=CK,len=*),intent(in) :: str_in
226226
character(kind=CK,len=:),allocatable,intent(out) :: str_out
227227

228-
integer(IK) :: i,ipos
228+
integer(IK) :: i
229+
integer(IK) :: ipos
229230
character(kind=CK,len=1) :: c
231+
#if defined __GFORTRAN__
232+
character(kind=CK,len=:),allocatable :: tmp !! workaround for bug in gfortran 6.1
233+
#endif
230234

231235
character(kind=CK,len=*),parameter :: specials = quotation_mark//&
232236
backslash//&
@@ -284,7 +288,12 @@ subroutine escape_string(str_in, str_out)
284288
if (ipos==1) then
285289
str_out = ''
286290
else
287-
str_out = str_out(1:ipos-1)
291+
#if defined __GFORTRAN__
292+
tmp = str_out(1:ipos-1) !workaround for bug in gfortran 6.1
293+
str_out = tmp
294+
#else
295+
str_out = str_out(1:ipos-1) !original
296+
#endif
288297
end if
289298
end if
290299

0 commit comments

Comments
 (0)