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

Code coverage when the main program is not a Fortran program

Arjen_Markus
Honored Contributor I
1,216 Views

We want to register the code coverage for a large Fortran library. This works fine, using the relevant compile option (-Qprof-gen:srcpos), when we use the library via a Fortran main program. However, to get the full functionality of the library it needs to cooperate with another library and the infrastructure we have for that has been implemented in C++.

Unfortunately, it appears that in this constellation the files that register the code coverage are not written (the *.dyn files).

Some details:

  • We run on Windows
  • The C++ compiler is MicroSoft Visual C++

The question now is: how can we arrange for the program to produce its coverage files anyway or is that not possible?

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
1,199 Views

The Intel code coverage feature does not handle code not compiled by Intel compilers. You should be getting .dyn files for the Fortran code. I don't think there's a requirement that the main program be compiled by an Intel compiler, but I am not certain.

View solution in original post

0 Kudos
6 Replies
Steve_Lionel
Honored Contributor III
1,200 Views

The Intel code coverage feature does not handle code not compiled by Intel compilers. You should be getting .dyn files for the Fortran code. I don't think there's a requirement that the main program be compiled by an Intel compiler, but I am not certain.

0 Kudos
Arjen_Markus
Honored Contributor I
1,192 Views

Well, that is not what I infer from my experiments: I did one calculation with the C++ program as the driver, that produced no .dyn files. Repeating the same calculation with the Fortran program did produce them. I have also noticed that the execution of a STOP statement prevented these .dyn files from appearing.

I do not expect the C++ code to be covered ;), but if my observation is correct, I will have to look for a different solution.

0 Kudos
Arjen_Markus
Honored Contributor I
1,153 Views

I am pretty sure we don't - it is definitely worth a try! Thanks.

0 Kudos
Arjen_Markus
Honored Contributor I
1,140 Views

Oh, it seems I was wrong about the C++ program not producing the .dyn files. They simply appear in a rather unexpected directory.

Some details: I use the option "-Qprof-dir: ." and then the .dyn files appear in the directory holding the .vfproj file in question. I was used to the relevant .vfproj file to be the one of the main program and I searched for these files in the directories for the various libraries. But I forgot that we also have some rather general libraries and the .dyn files were written there. In both cases: with the original C++ program driving the library and with the pair for_rtl_init_/for_rtl_finish_ in place.

Okay, that makes it easier from the perspective of the C++ program ;).

Steve_Lionel
Honored Contributor III
1,174 Views

Yes, a STOP would definitely prevent the .dyn file from appearing - I've seen that before. I don't know if it's possible to get the .dyn file if the main program isn't from an Intel compiler - perhaps someone else does.

0 Kudos
Reply