FPT and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Reference Manual Home |


SHOW LIVES

Syntax:

SHOW LIVES

Function:

The same variable within a program may be used to hold two or more different and unconnected values. When this occurs, the different uses of the symbol are referred to as different lives.

A life of a variable starts with an assignment or data initialisation. All accesses to the variable which may share the same assignment or initialisation are considered to be accesses to the same life. A life may end at the end of a sub-program, but does not necessarily do so if the variable is public in a module or is in a COMMON block. A life may end at an assignment which starts another life. If the data assigned to a variable in two or more assignments may be accessed by a single right-hand-side use, the different assignments refer to the same life. If two different assignments can never reach the same right-hand-side use the lives are distinct.

For example, in:

REAL x : : 1 x = MIN(a,b) WRITE(6,'("Minimum:",F12.6)')x 2 x = MAX(a,b) WRITE(6,'("Maximum:",F12.6)')x

The variable x has two lives, one starting at label 1, and one at label 2. The two uses of x are independent in that no data flows between them. Either could be renamed without changing the meaning of the code.

In the code:

REAL x : : IF (min_f) THEN 1 x = MIN(a,b) ELSE 2 x = MAX(a,b) ENDIF 3 WRITE(6,'(''X: ''.F12.6)')x

The assignments of x at labels 1 and 2 are not independent because either could be used at 3, and therefore belong to the same life.

Different lives are important in that real variables could have different physical units and dimensions in different lives without creating an inconsistency. Please see the commands SHOW UNITS and CHECK UNITS for a further discussion.

Note also that if the separate lives of a variable were renamed as different variables the meaning of a program would not change. This renaming may be carried out by the command SEPARATE SYMBOL LIVES. This is used in optimising code for some parallel architectures.

Where to use this command:

Operating system command line

Yes


Configuration file, config.fsp

Yes


Specification (FSP) files, *.fsp

Yes


Interactively, to FPT> prompt:

Yes


Interactive command files

Yes


Embedded in the Fortran code

Yes


Example:

The command

FPT> show lives

generates a listing for every variable of the form:

Symbol: AYSEN
=============
 
Name      Sub-prog/Struct  Use/COMMON  Address  Type    Size    Value/Bounds
----      ---------------  ----------  -------  ----    ----    ------------
AYSEN     ROTCON           Local                REAL    *4  df
 
Lives
=====
 
Life: 1
-------
Read accesses: 4
Units:         Undetermined
 
Assignments:
------------
Line: 2525,   File: e:\projects\fpt\fpttests\uh60a\original_source\bench.f
      AYSEN=AYPS
 
Life: 2
-------
Read accesses: 2
Units:         Undetermined
 
Assignments:
------------
 
Line: 2598,   File: e:\projects\fpt\fpttests\uh60a\original_source\bench.f
!
!     Longitudinal section Sensor filter
      AYSEN=C1S*AYSENP+C2S*AYSNPP+C3S*AYPSP+C4S*AYPSPP
 
------------------------------------------------------------------------------
 

See also:

CHECK UNITS

SHOW UNITS

SEPARATE SYMBOL LIVES


Copyright ©1995 to 2014 Software Validation Ltd. All rights reserved.