Path: utzoo!attcan!uunet!ns-mx!iowasp.physics.uiowa.edu!maverick.ksu.ksu.edu!zaphod.mps.ohio-state.edu!samsung!rex!uflorida!ufqtp!bernhold From: bernhold@qtp.ufl.edu (David E. Bernholdt) Newsgroups: comp.lang.fortran Subject: Interesting feature in Sun f77 Message-ID: <1250@orange19.qtp.ufl.edu> Date: 25 Jan 91 20:59:01 GMT Reply-To: bernhold@qtp.ufl.edu (David E. Bernholdt) Organization: University of Florida Quantum Theory Project Lines: 39 I've come across an interesting feature ;-) of Sun f77 v1.3.1. There is now a data type named BYTE, which is synonymous with LOGICAL*1. BYTEs are allowed in some, but not all places integers are allowed. They _can't_ be DO loop indices. They _can_ be array subscripts. Apparently due to BYTE and LOGICAL*1 being the same, it appears that _any_ LOGICAL variable can now be an array subscript. Not just things which are specifically LOGICAL*1, but all possible LOGICALs (*2, *4, and just plain)! A side effect of this side effect is that typos such as If ( A(i .lt. j) ) instead of If ( A(i) .lt. j ) are taken without comment and give you completely bogus results. My sample type is pretty easy to spot, but any Fortran programmer can probably imagine nice complex arguments where a misplaced parenthesis is much harder to spot. So... 1) Can anybody think of a way to get the compiler to help identify typos such as my example above? 2) Can anyone with experience writing compilers say if it is realistic to somehow expect that (for example) _only_ LOGICAL*1 be allowed as an array subscript, while LOGICAL and *2 and *4 would give errors? Basically, I want to know if I should consider this a bug which might have a fix or workaround, or as an undesirable feature? Thanks. -- David Bernholdt bernhold@qtp.ufl.edu Quantum Theory Project bernhold@ufpine.bitnet University of Florida Gainesville, FL 32611 904/392 6365