Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!pasteur!ucbvax!TECHNION.BITNET!AER7101 From: AER7101@TECHNION.BITNET (Zvika Bar-Deroma) Newsgroups: comp.lang.fortran Subject: fortran problem Message-ID: <8806111222.AA06982@jade.berkeley.edu> Date: 11 Jun 88 12:22:56 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 81 X-Unparsable-Date: Sat, 11 Jun 88 15:19:59 IST Hello, I have some questions concerning a bug (or as I call it, when it bares the name of a big manufacturer, an undocumented feature..). I ran the following program on several machines. There is "some problem" with the program, as in the subroutine, an attempt is made to redefine a constant. Naively enough, I expected to get a reasonably clear message in English, (not HEX location of unknown registers..), just as the following will: * this produces "clear" message: PARAMETER ( I=5) I=1 END The message you get follows: *ERR* EQ-02 line 2, column 7, cannot assign value to expression (That's WATFOR77's compiler, one could think of something better like: "trying to redefine a constant", which I saw somewhere, but even that's good enough..). Now try to run the following program. Do NOT allocate files (if possible with your system) and check the following: 1. On which unit it printed 'THIS SHOULD BE PRINTED ON UNIT 1' ? 2. What is the value of I printed on the default output unit ? CALL TRY ( 1 ) WRITE (1,*) 'THIS SHOULD BE PRINTED ON UNIT 1' I=1 WRITE (*,*) ' I (SHOULD BE 1) = ',I STOP END SUBROUTINE TRY ( KUKU ) KUKU = 8 RETURN END Following are the results of some compilers (refer to the questions): compiler/machine unit # I comments ************************ ****** * ******** IBM VS FORTRAN 2.2.0 8 1 OPT(2) causes I to be 8 .. IBM VS FORTRAN 1.4.1 8 8 WATFOR77 2.5 1 1 CDC/NOS FTN5 8 1 CDC/ NOS/VE FORTRAN runtime err: "ACCESS VIOLATION" + HEX location (when run with full debug causes the cursor to point at the "KUKU=8" line, in addition to the ACCESS VIOLATION error msg. ) VAX/VMS FORTRAN runtime err: "ACCESS VIOLATION" + HEX location WATFIV err. msg.: ***ERROR*** SUBPROGRAM TRY REDEFINES A CONSTANT, EXPRESSION, DO-PARAMETER OR ASSIGNED GOTO INDEX ( ARGUMENT NUMBER 1) PROGRAM WAS EXECUTING LINE 1 IN ROUTINE M/PROG WHEN TERMINATION OCCURED Unfortunately, WATFIV is FORTRAN 4 .... How does your compiler execute this program ? Can anyone tell me if/what the ANSI standard "says" to such a situation? How about the 8x draft ? (Of course, my program is a small demonstration of a problem that can be serious, as happened to a user here with a program a few thousand statements long, producing inexplicable results). Regards, Zvika Bar-Deroma dept. of Aeronautical eng. Technion, Haifa, Israel BITNET : AER7101@TECHNION INTERNET : AER7101%TECHNION.BITNET@cunyvm.cuny.EDU DOMAIN NAMING : AER7101@TECHNION.TECH.AC.IL UUCP : .....!ucbvax!aer7101@technion.bitnet CSNET : aer7101@technion.bitnet