4bsd-f77@utah-cs.UUCP (4.2 BSD f77 bug reports) (08/07/84)
From: Donn Seeley <donn@utah-cs.arpa> Subject: F77 doesn't say anything if your array bounds are out of order Index: usr.bin/f77/src/f77pass1/proc.c 4.2BSD Description: F77 does not remark on out-of-order dimension declarators. Not only is this not in accord with the standard, it breaks things (see below). This bug fix is from Bob Corbett at UC Berkeley, care of Jerry Berkman. Repeat-By: Clip out the following subroutine and compile it: ---------------------------------------------------------------- subroutine axmpl() integer m(10:1) m(5) = 0 return end ---------------------------------------------------------------- The compiler will say something like 'Termination code 139' and you will be left with a core dump of the assembler. Fix: Add some code to setbound() in proc.c: ---------------------------------------------------------------- *** /tmp/,RCSt1005919 Fri Jul 20 22:17:01 1984 --- proc.c Thu Jul 19 12:04:20 1984 *************** *** 1327,1332 } if( ISCONST(q) ) { p->dims[i].dimsize = q; p->dims[i].dimexpr = (expptr) PNULL; } --- 1334,1346 ----- } if( ISCONST(q) ) { + if (ISINT(q->headblock.vtype) + && q->constblock.const.ci <= 0) + { + err("array bounds out of sequence"); + frexpr(q); + q = ICON(0); + } p->dims[i].dimsize = q; p->dims[i].dimexpr = (expptr) PNULL; } ---------------------------------------------------------------- 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