This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[fortran,patch] Fix matching of format labels (PR 34108)
- From: FX Coudert <fxcoudert at gmail dot com>
- To: "fortran at gcc dot gnu dot org List" <fortran at gcc dot gnu dot org>, gcc-patches list <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 16 Nov 2007 23:27:08 +0000
- Subject: [fortran,patch] Fix matching of format labels (PR 34108)
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:to:message-id:content-type:from:subject:date:x-mailer; bh=HGRyTOpD12o6Vn86Q342aCR3xxmyawcXA9494JX4KEc=; b=R6mdDYtDKgTCVRYQQanp5QtBgRlMAd5jrT1ButXZvTtYKF+gLSZANQBiHXZh49eUSv2eQMNuUOP0hVXEqNfbLbNwitS3r+Gp90oJx7naoJBr7/II9f/4RXPEiEWSa+6BxtImA9FCVqZ0JYYGdFvLJDj0lWmAFgy3m3iBxGDQKNA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:to:message-id:content-type:from:subject:date:x-mailer; b=FBDYh4EgOHz/T2QbjULGveK7FGvdtlYL0yRCEaxyRjZ+uFGDfaDPfkN+7oWCbYDAg8euA8+YvV+CkwskZdzlb/JQEqTDD4vf7PEAbGSlCS27QJJL6qeQfPerrRnRTqAJ8o0pH+ra3jbO7PJV3KKUlwNY8FSCu8A7K2pBWNPuUB8=
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