This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[fortran,patch] Fix matching of format labels (PR 34108)


Attached patch fixes PR 34108, an ICE on invalid code such as "write (*,0)". This is due to a checking the e->value.character.string of the constant integer 0! This is fixed by the one line in check_format_string, but I noted that the fact that we even came to that point would be fixed is matching aborted earlier, with a more specific error message (instead of "Missing left parenthesis"!). But we can do better: if gfc_match_st_label() returns MATCH_ERROR, it means that it found an integer, that is not a suitable label, and we should emit that error message (either "label is zero" or "label has too many digits") and bail out, because we can't recover from that anyway (there's no way a litteral integer constant as format is valid if it's not a label).

Bootstrapped and regtested on x86_64-linux, comes with a testcase. OK for mainline ?

FX



:ADDPATCH fortran:

Attachment: pr34108.ChangeLog
Description: Binary data

Attachment: pr34108.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]