[flang][runtime] Fix use of empty optional in BOZ input (#120789)

Slava reported a valgrind result showing the use of uninitialized data
due to an unconditional dereference of an optional in BOZ formatted
input editing; fix.
This commit is contained in:
Peter Klausler
2025-01-08 13:12:25 -08:00
committed by GitHub
parent b8513e4393
commit 7463b46a34

View File

@@ -130,7 +130,7 @@ static RT_API_ATTRS bool EditBOZInput(
shift = shift - 8; // misaligned octal
}
while (digits > 0) {
char32_t ch{*io.NextInField(remaining, edit)};
char32_t ch{io.NextInField(remaining, edit).value_or(' ')};
int digit{0};
if (ch == ' ' || ch == '\t') {
if (edit.modes.editingFlags & blankZero) {