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

FX Coudert fxcoudert@gmail.com
Sat Nov 17 00:22:00 GMT 2007


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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr34108.ChangeLog
Type: application/octet-stream
Size: 351 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20071117/59c55459/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr34108.diff
Type: application/octet-stream
Size: 1627 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20071117/59c55459/attachment-0001.obj>


More information about the Fortran mailing list