diff --git a/flang-rt/lib/runtime/edit-input.cpp b/flang-rt/lib/runtime/edit-input.cpp index 13557678f6057..4945c987e928b 100644 --- a/flang-rt/lib/runtime/edit-input.cpp +++ b/flang-rt/lib/runtime/edit-input.cpp @@ -349,8 +349,8 @@ static RT_API_ATTRS ScannedRealInput ScanRealInput( } bool bzMode{(edit.modes.editingFlags & blankZero) != 0}; int exponent{0}; - if (!next || (!bzMode && *next == ' ') || - (!(edit.modes.editingFlags & decimalComma) && *next == ',')) { + const char32_t comma{GetSeparatorChar(edit)}; + if (!next || (!bzMode && *next == ' ') || *next == comma) { if (!edit.IsListDirected() && !io.GetConnectionState().IsAtEOF()) { // An empty/blank field means zero when not list-directed. // A fixed-width field containing only a sign is also zero; @@ -532,7 +532,7 @@ static RT_API_ATTRS ScannedRealInput ScanRealInput( while (next && (*next == ' ' || *next == '\t')) { next = io.NextInField(remaining, edit); } - if (next && (*next != ',' || (edit.modes.editingFlags & decimalComma))) { + if (next && *next != comma) { return {}; // error: unused nonblank character in fixed-width field } } diff --git a/flang-rt/unittests/Runtime/NumericalFormatTest.cpp b/flang-rt/unittests/Runtime/NumericalFormatTest.cpp index 73245dca13bc0..31b4150a042bd 100644 --- a/flang-rt/unittests/Runtime/NumericalFormatTest.cpp +++ b/flang-rt/unittests/Runtime/NumericalFormatTest.cpp @@ -921,6 +921,7 @@ TEST(IOApiTests, EditDoubleInputValues) { {"(BZ,F18.0)", " . ", 0x0, 0}, {"(BZ,F18.0)", " . e +1 ", 0x0, 0}, {"(DC,F18.0)", " 12,5", 0x4029000000000000, 0}, + {"(DC,F18.0)", " 12,5;", 0x4029000000000000, 0}, {"(EX22.0)", "0X0P0 ", 0x0, 0}, // +0. {"(EX22.0)", "-0X0P0 ", 0x8000000000000000, 0}, // -0. {"(EX22.0)", "0X.8P1 ", 0x3ff0000000000000, 0}, // 1.0