jlg@lanl.gov (Jim Giles) (03/02/89)
Consider the following code: 1 open(1,file='something',status='old') 2 open(1,blank='zero') 3 read(1,'(f7.12)')x ... 4 open(2,file='newfile',status='unknown') 5 write(1,'(f7.12)')x Possible errors are: 'something' and 'newfile' may not be legal file names. Acceptable file names are processor dependent - there may not even be any acceptable file names. The unit specifiers 1 and 2 may not exist. Acceptable unit specifiers are processor dependent - there must be _some_ which are legal though. 'something' may not exist at line 1 as required by the 'old' status. For status='unknown' in line 4, the status is processor dependent. If the processor dependent status is 'scratch', then the presence of a file name is illegal. The additional open in line 2 is _not_ illegal. Nor does it open another file. This open statement changes the blank meaning for the existing connection to unit 1. The format specification in line 3 is _not_ illegal. The standard gives a prefectly reasonable description of what should be done here. The format specification in line 5 _is_ illegal. The whole example may not be accepted by a compiler which doesn't accept lower case letters. All these examples are things that I have seen in benchmark and other test codes used by various people to test compilers/libraries. In addition, I have seen many compilers/libraries do some of the above wrong - especially lines 2 and 3! I am collecting examples of non-intuitive Fortran, particularly things that most people consider errors but which aren't. Anybody else out there got a favorite example? J. Giles Los Alamos