weird compiler behaviour

weird compiler behaviour

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 411compiler 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?

Downloadapplication/octet-stream netcdf_bfm.f17.42 KB
6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Please attach the source file rather than pasting it. See link below.

Retired 12/31/2016

sorry about the mess couldnt find how to attach

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.

Retired 12/31/2016
Best Reply

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.

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

Leave a Comment

Please sign in to add a comment. Not a member? Join today