[comp.lang.fortran] Order of variables in EQUIVALENCE statement

lindner@ncis.llnl.gov (Curt Lindner) (06/19/91)

I've been in the the process of converting some code using 'f77cvt' on 
a SUN Sparcstation. 

The conversion is swapping the variables in the equivalence statements,
which it shouldn't do, as far as I can tell. 

Does this have an adverse affect on the results of the code, i.e. does the
first variable take on the value of the second, or vice versa??

Thanks,

Curt

Curt Lindner                                                .....Go Jackets!
Nuclear Assurance Corp.
Norcross, Georgia           (404) 447-1144         lindner@ncis.tis.llnl.gov

ekman@wdl30.wdl.loral.com (Donald Ekman) (06/19/91)

In article <99850@lll-winken.LLNL.GOV> lindner@ncis.llnl.gov (Curt Lindner) writes:
>I've been in the the process of converting some code using 'f77cvt' on 
>a SUN Sparcstation. 
>
>The conversion is swapping the variables in the equivalence statements,
>which it shouldn't do, as far as I can tell. 
>
>Does this have an adverse affect on the results of the code, i.e. does the
>first variable take on the value of the second, or vice versa??
>
Since the equivalence statement simply causes each of the variable names to
reference the same storage location, the order is irrelevant, I believe.

Don


-- 
Donald E. Ekman, Space Systems/Loral, Palo Alto, CA  ekman@wdl30.wdl.loral.com

orville@weyrich.UUCP (Orville R. Weyrich) (06/19/91)

In article <1991Jun18.195315.18248@wdl1.wdl.loral.com> ekman@wdl30.wdl.loral.com (Donald Ekman) writes:
>In article <99850@lll-winken.LLNL.GOV> lindner@ncis.llnl.gov (Curt Lindner) writes:
>>I've been in the the process of converting some code using 'f77cvt' on 
>>a SUN Sparcstation. 
>>
>>The conversion is swapping the variables in the equivalence statements,
>>which it shouldn't do, as far as I can tell. 
>>
>>Does this have an adverse affect on the results of the code, i.e. does the
>>first variable take on the value of the second, or vice versa??
>>
>Since the equivalence statement simply causes each of the variable names to
>reference the same storage location, the order is irrelevant, I believe.

I would agree with you from the point of view of program correctness. 
However ...
I don't know about Sparcstations, but word-boundary alignment problems
used to haunt old IBM mainframes, and so the order could affect run-time
efficiency if the equivalenced variables were of different data types.


--------------------------------------           ******************************
Orville R. Weyrich, Jr., Ph.D.                   Certified Systems Professional
Internet: orville%weyrich@uunet.uu.net             Weyrich Computer Consulting
Voice:    (602) 391-0821                         POB 5782, Scottsdale, AZ 85261
Fax:      (602) 391-0023                              (Yes! I'm available)
--------------------------------------           ******************************

khb@chiba.Eng.Sun.COM (Keith Bierman fpgroup) (06/20/91)

>I've been in the the process of converting some code using 'f77cvt' on 

This suggests that you are not using current releases of software.
f77cvt was part of f77v1.2; but its functionality was rolled into
f77v1.3 (and the current release is v1.4).

--
----------------------------------------------------------------
Keith H. Bierman    keith.bierman@Sun.COM| khb@chiba.Eng.Sun.COM
SMI 2550 Garcia 12-33			 | (415 336 2648)   
    Mountain View, CA 94043