[gfortran, PR 18540] A few statement label cleanups
Tobias.Schlueter@Physik.Uni-Muenchen.DE
Tobias.Schlueter@Physik.Uni-Muenchen.DE
Tue Jan 17 19:52:00 GMT 2006
This patch contains a few cleanups dealing with statement labels, including
Steven's 1.5-liner which fixes PR18540, the recently heatly discussed issue of
not allowing cross-block jumps in the way last allowed in FORTRAN 66. Besides
that it cleans up gfc_match_small_literal_int to only return a value in the
'cnt' argument, if it gets passed non-NULL 'cnt', allowing the removal of 'cnt'
in the callers which had no use for it. Furthermore with this patch, statement
labels are stored in a balanced binary tree, which speeds up things measurably,
but since checking the validity of a jump currently means traversing a block,
this only cures one quadratic bottleneck in this area. I meant to also cure
the remaining quadraticness, but this turns out to be more difficult than I
thought, so I propose this self-contained patch, and hope to return to the
remaining issue later when I have more time.
Built and tested on i686-linux previously, new testcase attached. Ok?
- Tobi
PR fortran/18540
PR fortran/18937
* gfortran.h (BBT_HEADER): Move definition up.
(gfc_st_label): Add BBT_HEADER, remove 'prev' and 'next'.
* io.c (format_asterisk): Adapt initializer.
* resolve.c (resolve_branch): Allow FORTRAN 66 cross-block GOTOs
as extension.
* symbol.c (compare_st_labels): New function.
(gfc_free_st_label, free_st_labels, gfc_get_st_label): Convert to
using balanced binary tree.
* decl.c (match_char_length, gfc_match_old_kind_spec): Do away
with 'cnt'.
(warn_unused_label): Adapt to binary tree.
* match.c (gfc_match_small_literal_int): Only set cnt if non-NULL.
Remove superfluous assignment.
* primary.c (match_kind_param): Do away with cnt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: partial.diff
Type: application/octet-stream
Size: 9442 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060117/4a00452e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: goto_1.f
Type: application/octet-stream
Size: 301 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060117/4a00452e/attachment-0001.obj>
More information about the Fortran
mailing list