[comp.lang.fortran] A Bug any Decent Compiler Would Catch, NO, NOT f77......

ao@cevax.berkeley.edu (A Ozselcuk) (01/29/88)

f77 does not catch the error in the following code

	program foo2
	integer i, j, a(10,10)
	do 20 i = 1, 10
	    do 10 j = 1,10
	        i = i +1
		a(i,j) = 0
10	    continue
20	continue
        stop
	end


The following compilers catch the error:

ULTRIX fort  ( Based on DEC-VAX VMS Fortran )

WATFOR77  (on IBM 3090)

FORTVS or FORT22   (IBM`s own compilers on 3090)



However, f77 catches the following error:

	program foo
	integer i, j, a(10,10)
	do 20 i = 1, 10
	    i = i +1
	    do 10 j = 1,10
		a(i,j) = 0
10	    continue
20	continue
        stop
	end

and gets a standing ovation from me.
If you want to flame, please DO NOT SEND IT THROUGH THE NEWS,
e-mail will suffice.


Akin Ozselcuk                        Experientia Docet
ao@cevax.berkeley.edu                "We Learn From Disasters "
					     Motto of the Bidge Engineers

levy@ttrdc.UUCP (Daniel R. Levy) (01/31/88)

In article <22780@ucbvax.BERKELEY.EDU>, ao@cevax.berkeley.edu (A Ozselcuk) writes:
# f77 does not catch the error in the following code
# 
# 	program foo2
# 	integer i, j, a(10,10)
# 	do 20 i = 1, 10
# 	    do 10 j = 1,10
# 	        i = i +1
# 		a(i,j) = 0
# 10	    continue
# 20	continue
#         stop
# 	end

I tried this little ditty on a SYSTEM V f77 compiler:

$ uname -a
ttrdc ttrdc 2.0v3 1208 3B-20S
$ cat foo2.f
	program foo2
	integer i, j, a(10,10)
	do 20 i = 1, 10
	    do 10 j = 1,10
	        i = i +1
		a(i,j) = 0
10	    continue
20	continue
        stop
	end
$ f77 -c foo2.f
foo2.f:
   MAIN foo2:
Error on line 5 of foo2.f: redefinition of do variable

Error.  No assembly.
-- 
|------------Dan Levy------------|  Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
|         an Engihacker @        |  	<most AT&T machines>}!ttrdc!ttrda!levy
| AT&T Computer Systems Division |  Disclaimer?  Huh?  What disclaimer???
|--------Skokie, Illinois--------|