DL01@TE.CC.CMU.EDU (David B. Love) (09/14/87)
The following F77 program excerpt used to work fine on a PDP11/44 running RSX11M+, but does not on our uVax running uVMS 4.4. Any thoughts ? * Main Program CALL A CALL B * Subroutines SUBROUTINE A COMMON Q1(81), Q2(81) Q1()=... - GETS VALUE 0.0 Q2()=... - GETS VALUE 0.7 RETURN SUBROUTINE B COMMON Q1(81), Q2(81) H1=Q1(N) - RETURNS AS = 2.7 FOR SOME H2=Q2(N) UNKNOWN REASON RETURN For some unknown reason, between storing the common area values in subroutine A, and recalling them in subroutine B, the values changed. We were able to fix this problem by putting subrouting A and B together into one Subroutine AB. I know its solved now, but I would like to know why I have to "un-modularize" my programs. Thanks for any help people have. David B. Love DL01@TE.CMU.CC.EDU ---K=6,
EVERHART%ARISIA.DECnet@GE-CRD.ARPA (09/17/87)
The program cited by Dave Love that runs OK on RSX11M and fails on VMS is likely suffering from the fact that, absent a SAVE statement or the /NOF77 switch, variables in subroutines are not kept in existence across subroutine calls. The RSX implementation would let this slide by and act as if the commons were in the root. Under VMS, not defining the commons used in the calling program (the root in this case) can validly be taken by the compiler to mean that the common doesn't have to hang around. While it is surprising that common declarations would work this way, it's a feature of fortran 77 that's optional. Glenn