Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 9/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

View Fortran Data Types in the Microsoft Debugger

This topic applies to Fortran applications for Windows only.

The following general suggestions apply to different types of Fortran data:

  • For scalar (nonarray) data, use the data tips (leave pointer on a variable name) feature or use the Locals window or a Watch window. Intel® Fortran does not support the Autos window.

  • For single-dimension array data, derived-type data, record structure data, and COMPLEX data, use the Locals window or a Watch window.

  • For common blocks exported from a DLL, enter the name of the common block in a Watch window. You will be able to view the common block variables like any other structure.

  • By default, values of named constants (parameters) are not visible in the debugger. To make these visible, add the /debug-parameteres:used option or /debug-parameters:all option when compiling the sources.

For information on using Data Tips, the Locals window, or a Watch window, see Debugging the Squares Example Program.

The following sections apply to using a Watch window:

To display a Watch window:

  1. In the Debug menu, select Windows > Watch.

  2. In the submenu, click Watch 1, 2, 3, or 4.

Specify Array Sections

You can specify array sections in a Watch window. For example, consider an array declared as:

  integer foo(10)

You can specify the following statement in a Watch window to see the 2nd, 5th, and 8th elements:

  foo(2:10:3)

When working with character arrays, this syntax may be combined with a substring specification. Consider the following array declaration:

  character*8 chr_arr(10)

You can specify the following statement in a Watch window to display the substring made up of character 3 through 8 of array elements 2 through 5:

  chr_arr(2:5)(3:8)

This support is available for arrays of any type, including array pointers, assumed-shape, allocatable, and assumed-size arrays.

Any valid integer expression can be used when specifying lower bound, upper bound, or stride. If the lower bound is omitted, the array lower bound is used. If the upper bound is omitted, the array upper bound is used. For example, consider the following declaration:

  integer foo(10)

To display:

  • Elements 1 through 8, specify foo(:8)

  • Elements 5 through 10, specify foo(5:)

  • All 10 elements, specify foo(:)

Specify Module Variables

To view a module variable in a Watch window, specify the module name, followed by "::", followed by the variable name.

For example, to watch variable "bar" of module "foo", specify the following expression:

foo::bar

Specify Format Specifiers

You can use format specifiers in Watch windows to display variables in different data formats.

For example, given a REAL variable 'foo' in a program, it is now possible to see 'foo' in different floating point notation (by typing "foo,f" "foo,g" or "foo,e" in a Watch window) or as an integer ("foo,i" or "foo,d"), a hexadecimal value ("foo,x"), an an octal value ("foo,o"), and so on.

You can change the display format of variables in a Watch window using the formatting symbols in the following table:

Symbol

Format

Value

Displays

d,i

signed decimal integer

0xF000F065

-268373915

o

unsigned octal integer

0xF065

0170145

x,X

Hexadecimal integer

61541 (decimal)

#0000F065

f

signed floating-point

3./2.

1.5000000

e

signed scientific notation

3./2.

0.1500000E+01

g

signed floating-point or signed scientific notation, whichever is shorter

3./2.

1.500000

c

Single character

0x0065

'e'

s

String

0x0012fde8

"Hello world"

To use a formatting symbol, type the variable name, followed by a comma and the appropriate symbol. For example, if var has a value of 0x0065, and you want to see the value in character form, type var,c in the Name column on the tab of the Watch window. When you press ENTER, the character-format value appears:

  var,c = 'e'

You can use the formatting symbols shown in the following table to format the contents of memory locations:

Symbol

Format

Displays

ma

64 ASCII characters

0x0012ffac .4...0...".0W&.......1W&.0.:W..1...."..1.JO&.1.2.."..1...0y....1

m

16 bytes in hexadecimal, followed by 16 ASCII characters

0x0012ffac B3 34 CB 00 84 30 94 80 FF 22 8A 30 57 26 00 00 .4...0...".0W&..

mb

16 bytes in hexadecimal, followed by 16 ASCII characters

0x0012ffac B3 34 CB 00 84 30 94 80 FF 22 8A 30 57 26 00 00 .4...0...".0W&..

mw

8 words

0x0012ffac 34B3 00CB 3084 8094 22FF 308A 2657 0000

md

4 doublewords

0x0012ffac 00CB34B3 80943084 308A22FF 00002657

With the memory location formatting symbols, you can type any value or expression that evaluates to a location.

A formatting character can also follow an expression:

  rep+1,x
  xloc,g
  count,d

NOTE:

You can apply formatting symbols to structures, arrays, pointers, and objects as unexpanded variables only. If you expand the variable, the specified formatting affects all members. You cannot apply formatting symbols to individual members.