Print

Print


Dear colleagues,

There is a "standard" technique that is not strictly supported by the fortran
standard:

        real a(n)

        call sub(n,a,a)

        ! ...

        subroutine sub(n, a, ia)
        integer n
        real a(n)
        integer ia(n)

        ! ... do things with integer and real versions of a.
        ! ... for example, row and column indices might be interspersed
        ! ... with data in some sparse matrix format.

        end

That is, the same array is passed in as two arguments.  This is used commonly
in legacy code in conjunction with fancy memory management.  My example is not
the actual code, just a simplified representation, and of course one has to
make sure that sizes are adjusted depending on real and integer type
byte-length.

I was wondering if there are HPF directives or fortran 90/95 attributes which
could be used within the *subroutine*, not the calling program, to tell a
compiler that it should assume that two dummy arguments could refer to the
same section of memory.  I'd like to avoid changing the argument structure of
the routine (say by adding an equivalence statement) since this is a port, not
a rewrite.  If there is a pseudo-portable or well-recognized convention that
could be used for this, I'll make a recommendation to the compiler people here
that such a convention be supported.

Telling code writers and maintainers that they deserve what they get for using
such heinous methods is not an option ;-).

Thanks for your time,

-- 
 Ted Stern                                                  [log in to unmask]
 Tera Computer Company                                 http://www.tera.com
 2815 Eastlake Avenue East                                  (206) 490-2182
 Seattle, WA  98102-3027                               FAX: (206) 323-1318


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%