Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Debugging inside a BLOCK construct

Andrew_Smith
Valued Contributor I
864 Views

With IFORT (Intel® Fortran Compiler Classic 2021.12.0 [Intel(R) 64]) the variables declared local to the block cannot be seen by the debugger.

So I switched to IFX (Intel® Fortran Compiler 2025.2.1 [Intel(R) 64]) and now they can be seen. But the local variables declared outside the block are now invisible!

Attached files replicate the problem with IFX. The use of an include file triggers the issue.

 

6 Replies
jimdempseyatthecove
Honored Contributor III
846 Views

You win some - you lose some.

As a hack

block
associate(VariableOfInterest_=>VariableOfInterest)
real :: blockLocalVariable
...
end associate
end block

Jim Dempsey

 

JohnNichols
Valued Contributor III
822 Views

Jim:

Why would you use a block? 

It is like starting a fire with a match when someone has a torch. 

JMN

0 Kudos
andrew_4619
Honored Contributor III
820 Views

You would use one because they can be quite useful and they exist!

0 Kudos
jimdempseyatthecove
Honored Contributor III
744 Views

Think of a BLOCK as an inline contained subroutine complete with its own local variable declarations yet within the scope of the procedure containing the block.

 

Jim Dempsey

0 Kudos
Andrew_Smith
Valued Contributor I
728 Views

The c language and most others allow variables to be declared when needed anywhere within your statements.

Fortran restricts us to declare all variables before any statements. I am not sure why Fortran has always had this restriction. Has there been proposals to change the standard in this area? I cant imagine it would affect performance but would greatly improve the coding experience.

A Fortran BLOCK allows you to create new variables almost anywhere. Its not as nice or as flexible as c. 

0 Kudos
JohnNichols
Valued Contributor III
532 Views

Accepting all that is said, I like a nice subroutine name such as 

INPUT

LOAD

ANALYSIS

EIGENVALUES

OUTPUT

 

Reply