You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm finding that fortran (gfortran 9.4 on linux, specifically), complains about an end of record when I try to write a string with long lines (~2500 characters) separated by newlines, with the error in line 221.
From what I can tell, i (calculated in the previous source line) is the location of the newline, arbitrarily far into the string, so an arbitrarily large integer. As a result, the write statement that runs if a newline is found (i > 0) writes an arbitrarily long string to the file (from current location n to n+i-2).
I think some other logic is supposed to be used (maybe just put this if clause after the one that checks against MAX_BUF_SIZE?), but I don't quite understand what's supposed to be happening.
The text was updated successfully, but these errors were encountered:
I think this is a sufficient fix, but I'm not sure I fully understand the logic to be confident
diff --git a/common/m_common_buffer.F90 b/common/m_common_buffer.F90
index 0bf5183..de463ec 100644
--- a/common/m_common_buffer.F90
+++ b/common/m_common_buffer.F90
@@ -216,7 +216,8 @@ contains
do while (n<=len(s2))
! Note this is an XML-1.0 only definition of newline
i = scan(s2(n:), achar(10)//achar(13))
- if (i>0) then
+ if (i>0 .and. i-2<MAX_BUFF_SIZE) then
+ ! close enough newline, use it
! turn that newline into an output newline ...
write(buffer%unit, '(a)') s2(n:n+i-2)
n = n + i
Can anyone explain the logic of this if statem and the block it controls?
fox/common/m_common_buffer.F90
Line 219 in 6f60cf1
I'm finding that fortran (gfortran 9.4 on linux, specifically), complains about an end of record when I try to write a string with long lines (~2500 characters) separated by newlines, with the error in line 221.
From what I can tell,
i
(calculated in the previous source line) is the location of the newline, arbitrarily far into the string, so an arbitrarily large integer. As a result, thewrite
statement that runs if a newline is found (i > 0
) writes an arbitrarily long string to the file (from current locationn
ton+i-2
).I think some other logic is supposed to be used (maybe just put this if clause after the one that checks against
MAX_BUF_SIZE
?), but I don't quite understand what's supposed to be happening.The text was updated successfully, but these errors were encountered: