This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

[gfortran, PR 18540] A few statement label cleanups


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.

Attachment: partial.diff
Description: Binary data

Attachment: goto_1.f
Description: Binary data


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