[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with trnshl



Christelle,

The following bug will cause "access violation" errors.  I don't if it's
your problem or not, but it plauged me so I thought I would pass it along.

The following passage comes fromt the file "New Features for Compaq Visual
Fortran Version 6.1"

{quote}
New features added to Compaq Visual Fortran (Visual Fortran) Version 6.1
(since Version 6.0.A) include the following:
  .
  .
  .
  .
  .
Visual Fortran puts literals into read-only memory so storing into a dummy
argument that has a constant as its associated actual argument will result
in an access violation and program termination:


 call f(0)
 ...
 subroutine f(i)
 i=1                ! this will die
{unquote}

I ran into this problem when trying to use some of the routines from the
ASHRAE Primary Toolkit (see TRNLIB at
http://sel.me.wisc.edu/TRNSYS/Default.htm).  Many of the routines following
use the following call to the TRNSYS standard PSYCH subroutine (see for
instance the Cooling Tower routine ( nummber 1110))

      CALL PSYCH(TIME,INFO,1,2,0,PSYDAT,1,0,*15)

The following fragment is from the PSYCH routine:

      SUBROUTINE PSYCH(TIME,INFO,IUNITS,MODE,WBMD,PSYDAT,EMODE,STATUS,*)
        .
        .
        .
        .
        .
      STATUS = 0

The "access violation" occurs because the CALL statement passes a constant
(literal) value of 0 for the variable STATUS.  The problem can be
eliminated by changing the CALL to:

      CALL PSYCH(TIME,INFO,1,2,0,PSYDAT,1,STATUS,*15)

There's problably a compiler switch that would disable this new feature but
I haven't looked for it yet.

As I said, I don't know if this has anything to do with your problem.  You
might however take a quick look at the routines you are using.

Good Luck,

Jeff Miller


AIL Research, Inc.
50 Washington Rd.
P.O. Box 3662
Princeton, NJ  08543-3662
PH:  (609) 452-2950 x53
FAX: (609) 452-2856