Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flang-rt/lib/runtime/edit-input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
}
}
Expand Down
1 change: 1 addition & 0 deletions flang-rt/unittests/Runtime/NumericalFormatTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading