[net.bugs.4bsd] [4bsd-f77 #34] f77 runs out of internal labels on long programs

4bsd-f77@utah-cs.UUCP (4.2 BSD f77 bug reports) (08/28/84)

From: Donn Seeley <donn@utah-cs.arpa>

Subject: f77 runs out of internal labels on long programs
Index:	usr.bin/f77/src/f1/order.c 4.2BSD

Description:
	On huge programs (> 20,000 lines) the code generation pass
	of f77 can run out of internally generated labels.  This bug
	was found and fixed by Jerry Berkman at UC Berkeley.

Repeat-By:
	Jerry has a program that will do this -- he also has a script
	that will construct an appropriately huge program.  Rather than
	dump it all in your lap, I instead will suggest that you write
	Jerry or me for it if you really want it.

Fix:
	The problem is that the code generator makes internal labels by
	picking numbers starting at 9999 and descending, and prepending
	'L' to them.  In fact all local labels have a similar format,
	from every pass of f77 and from the C compiler as well.  This
	is wrong-headed -- each pass should have its own unique
	internal label prefix that can't be confused with any other
	pass's prefixes, something like 'LF77.0.9999' -- but this
	practice has continued since time immemorial and who am I to
	argue with history?  At any rate you can get ten times as many
	labels as before if you simply boost the base for label
	generation to 99999, which leaves it just below the start of
	labels generated by the peephole optimizer.  The change is
	before the routine getlab() in f1/order.c:

	----------------------------------------------------------------
	*** /tmp/,RCSt1024810	Sun Aug 19 22:48:14 1984
	--- order.c	Sat Aug  4 20:32:39 1984
	***************
	*** 445,451
		cerror( "illegal setasop" );
		}
	  
	! int crslab = 9999;  /* Honeywell */
	  
	  getlab(){
		return( crslab-- );

	--- 470,476 -----
		cerror( "illegal setasop" );
		}
	  
	! int crslab = 99999;  /* VAX */
	  
	  getlab(){
		return( crslab-- );
	----------------------------------------------------------------

	What a hack,

Donn Seeley    University of Utah CS Dept    donn@utah-cs.arpa
40 46' 6"N 111 50' 34"W    (801) 581-5668    decvax!utah-cs!donn