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

Debugger one line off after #include

uha
Novice
548 Views

I hit an issue with the debugger - it gets confused about the line the source is in:

 

uha_0-1715339543851.png

 

 

I know this happens  when your build/pdb is out of date, this  is not the case here. Instead it is related to a somewhat weird combination of #include (preprocessor) and include (Fortran).

To reproduce I have 4 files: 2 include files, one module and a main:

SomeFile.fi:

 

 

integer, parameter :: someval = 88

 

 

OtherFile.fi:

 

 

!#DEFINE BLA_BLA
#IF .NOT. DEFINED (BLA_BLA)
#DEFINE MyFun(a, b, c) .true.
#ELSE
      USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_LOC
#ENDIF

 

 

TestInclude.f90 (do not remove the empty line 14 for clarity):

 

 

module MTestInclude
#include "OtherFile.fi"
#IF DEFINED (SIGNAL_MEM_ARRS)
  use NonExistantModule
#ENDIF
  implicit none
  save

  contains

subroutine test()
  include "SomeFile.fi"
  write(*,*) someval

end subroutine test

end module MTestInclude

 

 

Console1.f90:

 

 

program main
  use MTestInclude
  call test()
end program main

 

 

It does not only offset the debugger in the function with the include, but also for other functions defined after that one in the same file. Interestingly it seems you need the combination of #include and include to break it.

So for me the simple workaround is to include "OtherFile.fi" instead of #include "OtherFile.fi", just thought it might be of interest. Or maybe there is something actually wrong with the #include version?

0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
505 Views

FWIW I use fpp and #include extensively in my solution, but I do not use "include". I do not have a line positioning error.

 

Note, if you are compiling with any optimizations enabled, you can(may) see such behavior.

 

Jim Dempsey

0 Kudos
uha
Novice
451 Views

Thanks Jim. This is in a Debug build with no optimizations. But good point about only using #include: Another way to get it to work as it should.

0 Kudos
Reply