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

weird compiler behaviour

yairsuari1
Beginner
925 Views
i am using intel fortran compiler and experience a weird behaviour

i have a subroutine writing data to netcdf called from the main program and causing a library error.
when debugging i saw that the program first jumps to line 411 of the source code and only then to the first executable line of the code at 96 (the source is attached).
when looking at the assembler code i see the same thing.

the netcdf error sais the unlimited dimension is defined more then once and that is waht is done in line 411
compiler flags were:
-g -C -traceback -check all -debug all -w95 -save -cpp -w90 -w95 -w -vec-report1 -r8 -i4 -heap-arrays


thanks alot to anyone who can help
what is going on?




0 Kudos
1 Solution
mecej4
Honored Contributor III
925 Views
If you want to do symbolic debugging, and you want to have the line-number tightly associated with the instruction-pointer, make sure that no explicit optimization flags are used, either in the command line or in the file ifort.cfg. The exception to this recommendation is when you have a bug that appears only when optimizations are on.

If optimizations are on, the compiler applies various transformations to the source code, which decrease the correlation between line-number and instruction-pointer. Some statements may be removed by the optimizer; entire functions may be inlined. These transformations make it harder to debug code, especially because you know neither where the transformations are located nor what they are.

View solution in original post

0 Kudos
5 Replies
Steven_L_Intel1
Employee
925 Views
Please attach the source file rather than pasting it. See link below.
0 Kudos
yairsuari1
Beginner
925 Views
sorry about the mess couldnt find how to attach
0 Kudos
Steven_L_Intel1
Employee
925 Views
Can you provide a short program that calls this subroutine and demonstrates the problem? What exactly is the problem? The jumping around while debugging is common and not indicative of an error - it has to do with the way source lines are associated with individual instructions.
0 Kudos
mecej4
Honored Contributor III
926 Views
If you want to do symbolic debugging, and you want to have the line-number tightly associated with the instruction-pointer, make sure that no explicit optimization flags are used, either in the command line or in the file ifort.cfg. The exception to this recommendation is when you have a bug that appears only when optimizations are on.

If optimizations are on, the compiler applies various transformations to the source code, which decrease the correlation between line-number and instruction-pointer. Some statements may be removed by the optimizer; entire functions may be inlined. These transformations make it harder to debug code, especially because you know neither where the transformations are located nor what they are.

0 Kudos
yairsuari1
Beginner
925 Views
I think i got it figured out.
In this subroutine there are some variables used which should be first allocate, if i enter the subroutine with those variables allocated there is no problem.
thanks for your help
0 Kudos
Reply