File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -976,14 +976,10 @@ static RT_API_ATTRS bool EditListDirectedCharacterInput(
976976 return false ;
977977 }
978978 // Undelimited list-directed character input: stop at a value separator
979- // or the end of the current record. Subtlety: the "remaining" count
980- // here is a dummy that's used to avoid the interpretation of separators
981- // in NextInField.
982- Fortran::common::optional<int > remaining{length > 0 ? maxUTF8Bytes : 0 };
983- while (Fortran::common::optional<char32_t > next{
984- io.NextInField (remaining, edit)}) {
979+ // or the end of the current record.
980+ while (auto ch{io.GetCurrentChar (byteCount)}) {
985981 bool isSep{false };
986- switch (*next ) {
982+ switch (*ch ) {
987983 case ' ' :
988984 case ' \t ' :
989985 case ' /' :
@@ -1003,11 +999,17 @@ static RT_API_ATTRS bool EditListDirectedCharacterInput(
1003999 break ;
10041000 }
10051001 if (isSep) {
1006- remaining = 0 ;
1007- } else {
1008- *x++ = *next;
1009- remaining = --length > 0 ? maxUTF8Bytes : 0 ;
1002+ break ;
1003+ }
1004+ if (length > 0 ) {
1005+ *x++ = *ch;
1006+ --length;
1007+ } else if (edit.IsNamelist ()) {
1008+ // GNU compatibility
1009+ break ;
10101010 }
1011+ io.HandleRelativePosition (byteCount);
1012+ io.GotChar (byteCount);
10111013 }
10121014 Fortran::runtime::fill_n (x, length, ' ' );
10131015 return true ;
You can’t perform that action at this time.
0 commit comments