[flang-commits] [flang] [llvm] [flang-rt] Split large unformatted sequential records into subrecords (PR #213003)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Fri Oct 16 12:50:14 PDT 2026


================
@@ -117,6 +117,17 @@ restore the unconditional whole-object copy-out. Note that this restores
 stores of unmodified data as well (including into read-only storage), so it
 is an escape hatch and A/B-comparison aid, not a safer mode.
 
+## `FLANG_RT_MAX_SUBRECORD_LENGTH`
+
+Set to an integer value to limit the number of payload bytes that the runtime
+places in one subrecord of an unformatted sequential record
+A record longer than this limit is written as a chain of subrecords whose
+4-byte length markers are negative when another subrecord follows, which is
+the layout that gfortran uses.
+The default, which also applies when the value is not a positive integer no
+greater than 2147483639, is the largest length that a signed 32-bit marker
+can describe; records shorter than that keep a single header and footer.
----------------
eugeneepshteyn wrote:

A few details here don't match the code: line 123 needs a period; only the *headers* are negative when another subrecord follows (a footer is negative when a subrecord precedes it, as in the `-13 [13] 13 | -13 [13] -13 | … | 9 [9] -9` layout this PR tests); and the default is 2147483639, gfortran's default, not the largest length a signed 32-bit marker can describe (2147483647). The comment on `maxSubrecordLength` in `environment.h` says the same.

https://github.com/llvm/llvm-project/pull/213003


More information about the flang-commits mailing list