Skip to main content
16 events
when toggle format whatbylicensecomment
yesterdaycommentadded dave Oh, I misread what you originally wrote - I read as if it compiled a proper format statement as a consequence of the PRINT referencing it. Apologies.
yesterdaycommentadded Leo B. @dave Indeed, I used DIMENSION FORMAT(10). Without it, nothing is formed out of the ambiguous statement, and even if it is labeled, the print statement complained about an undefined label. The compiler is FOREX by the Keldysh Institute of Applied Mathematics in Moscow (F O R E X ИПM AH CCCP 4.13 OT 11.09.85)
yesterdaycommentadded Leo B. @dave It forms an assignment and gives the address of the machine code to the print operator as the address of the format string.
yesterdayvoteacceptAdrian McCarthy
yesterdaycommentadded Adrian McCarthy The second section of this answer clears it up for me. Thanks.
yesterdaycommentadded dave @LeoB. - have you tried compiling DIMENSION FORMAT(10) \ X5H = 1 \ FORMAT(X5H)=... ? Does the DIMENSION statement nudge the compiler toward an assignment? (with illegal real subscript...)
yesterdayhistory edited daveCC BY-SA 4.0
added 322 characters in body
yesterdaycommentadded dave Why garbage? It was legal in FORTRAN IV to have a FORMAT with only hollerith and blank conversions, e.g. to print titles. So once you've decided it was a FORMAT and not an arithmetic statement, it should work. (I am not disbelieving you, I just don't get why that bug happens). What compiler?
yesterdaycommentadded Leo B. @JohnDoty Out of 3 FORTRAN compilers I can try, two treat it as a FORMAT statement if it is labeled, but behave differently when it is not (one prints a warning as for any other unlabeled FORMAT statement, the other ignores the statement silently), and the third compiler compiles the statement as an assignment operator. If it is labeled and a PRINT statement refers to it, garbage in the output and I/O errors result.
2 days agocommentadded texdr.aft here are pointers to the source code for FORTRAN I/II: texdraft.github.io/fortran/fortran-10.html#C0190-definition subroutine for getting next nonblank; texdraft.github.io/fortran/fortran-10.html#CB000-definition part of logic for statement classification
2 days agohistory edited daveCC BY-SA 4.0
added 4 characters in body
2 days agocommentadded dave True. Per the FORTRAN II logic, that would be classified as an arithmetic statement.
2 days agohistory edited daveCC BY-SA 4.0
added 684 characters in body
2 days agocommentadded John Doty There is the infamous FORMAT(X5H)=(1.), an ambiguous but improbable statement.
2 days agohistory edited daveCC BY-SA 4.0
added 85 characters in body
2 days agohistory answered daveCC BY-SA 4.0
close