Skip to content

Commit c698a10

Browse files
committed
[Flang] Fix wrong compile-time error message, issue #178494.
1 parent 0e7ddf3 commit c698a10

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

flang/lib/Parser/io-parsers.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,11 @@ TYPE_PARSER(construct<format::FormatItem>(
552552
construct<format::FormatItem>(
553553
maybe(repeat), Parser<format::DerivedTypeDataEditDesc>{}) ||
554554
construct<format::FormatItem>(Parser<format::ControlEditDesc>{}) ||
555+
// Error recovery: accept [r] before control-edit-desc so that the
556+
// format validator can diagnose a repeat specifier before descriptors
557+
// like SS, SP, S, BN, BZ, etc., rather than failing the parse entirely.
558+
construct<format::FormatItem>(
559+
maybe(repeat), Parser<format::ControlEditDesc>{}) ||
555560
construct<format::FormatItem>(charStringEditDesc) ||
556561
construct<format::FormatItem>(maybe(repeat), parenthesized(formatItems)))
557562

0 commit comments

Comments
 (0)