[net.lang.f77] User errors not detected by f77

pmontgom@sdcrdcf.UUCP (Peter Montgomery) (09/07/84)

C               The SAVE statement in the main program references
C               a non-existent common block, and should cause a
C               compile time error.

C               Subroutine doif has a missing "end if".  It gets a
C               misleading message about a branch to label 10
C               from outside the block, and an undefined label
C               during assembly.

C               Subroutine test has conflicting uses of "a"
C               (dummy argument and symbolic constant).

C               The problems exist under both 4.1bsd and 4.2bsd.
C               On a larger version of subroutine test, 4.1bsd complained
C               "Out of memory" (the larger program was not
C               tried under 4.2bsd).

C               The program gets the following messages when compiled
C               with default options:

C   usererr.f:
C      MAIN s:
C      doif:
C   Warning on line 51 of usererr.f: there is a branch to label 10 from outside block
C      test:
C   Assembler:
C   "/tmp/fort12421.s", line 51: WARNING: brb: destination label is external
C   Undefined:
C   _y_
C   L27
	program s
	common /x/ x
	save /y/
	end

	subroutine  doif
	integer i, j, k

	do 10 i = 1, 20
	    if (i.gt.1) then
		j = 2
	    else
		j = 3

	    if (i.eq.j) then
		k = 1
	    else
		k = 2
	    end if
10      continue
	end

	subroutine test(a, b)
	integer a, b
	parameter(a=5)
	b = a
	end
-- 
			Peter Montgomery

        {akgua,allegra,bli,blix,bmcg,burdvax,cbosgd,csun,hplabs,hughes,
	 ihnp4,ihnss,netvax,orstcs,parallax,randvax,sdccsu3,sdcnet,sdcsvax,
	 slant45,trw-unix,ucla-s,ucla-vax}!sdcrdcf!pmontgom