Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29280 Discussions

Help re compiler options in Visual Studio

simonwoodward
Beginner
1,611 Views
I have fiddling with the compiler options in Visual studio to try and get some better diagnostics on my code. In particular I am wanting the compiler to check such things as:
- unused variable declarations
- unused COMMON blocks
- correct arguments in subroutine calls
Are their compiler options for these things?
Also, how do I restore the default compiler options for release/debug configurations?
Thanks
Simon
0 Kudos
6 Replies
Steven_L_Intel1
Employee
1,611 Views
There is an option /warn:unused that will complain about unused declared variables. The option /warn:interface, which is on by default in a Debug configuration, will check argument consistency. There isn't an option that will check for unused COMMON blocks.

The /warn options are on the Diagnostics property page.

There is not an automated way of resetting project properties.
0 Kudos
simonwoodward
Beginner
1,611 Views
Thanks!
I have these options switched on, but I'm not getting any warnings. The code has a lot fo undeclared variables, and I have introduced a bug in the form of a missing argument in a subroutine call, but it's not reporting these. The build is producing no errors or warnings. And the *.diag file is empty, and the build log doesn't have any errors of warnings either.
0 Kudos
simonwoodward
Beginner
1,611 Views
This is the build log:
------ Build started: Project: FWNProject2, Configuration: Debug|Win32 ------

Compiling with Intel Fortran Compiler 10.0.025 [IA-32]...
ifort /nologo /Zi /Od /assume:nocc_omp /extend_source:132 /Qdiag-file:"Debug\fwnd.diag" /warn:all /fpe:0 /module:"Debug\" /object:"Debug\" /traceback /check:bounds /check:uninit /libs:static /threads /dbglibs /c /extfor:f /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft Visual Studio 8\VC\bin" "L:\Simon\FWN\FWNProject2\FWNProject2\opkda1.f"
ifort /nologo /Zi /Od /assume:nocc_omp /extend_source:132 /Qdiag-file:"Debug\fwnd.diag" /warn:all /fpe:0 /module:"Debug\" /object:"Debug\" /traceback /check:bounds /check:uninit /libs:static /threads /dbglibs /c /extfor:f /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft Visual Studio 8\VC\bin" "L:\Simon\FWN\FWNProject2\FWNProject2\opkda2.f"
ifort /nologo /Zi /Od /assume:nocc_omp /extend_source:132 /Qdiag-file:"Debug\fwnd.diag" /warn:all /fpe:0 /module:"Debug\" /object:"Debug\" /traceback /check:bounds /check:uninit /libs:static /threads /dbglibs /c /extfor:f /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft Visual Studio 8\VC\bin" "L:\Simon\FWN\FWNProject2\FWNProject2\femwaterN7.f"
ifort /nologo /Zi /Od /assume:nocc_omp /extend_source:132 /Qdiag-file:"Debug\fwnd.diag" /warn:all /fpe:0 /module:"Debug\" /object:"Debug\" /traceback /check:bounds /check:uninit /libs:static /threads /dbglibs /c /extfor:f /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft Visual Studio 8\VC\bin" "L:\Simon\FWN\FWNProject2\FWNProject2\opkdmain.f"
Linking...
Link /OUT:"Debug\FWND.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST:NO /DEBUG /PDB:"L:\Simon\FWN\FWNProject2\FWNProject2\debug\fwnd.pdb" /SUBSYSTEM:CONSOLE "Debug\opkda1.obj" "Debug\opkda2.obj" "Debug\femwaterN7.obj" "Debug\opkdmain.obj"
Link: executing 'link'


FWNProject2 - 0 error(s), 0 warning(s)
0 Kudos
Steven_L_Intel1
Employee
1,611 Views
Oh - you're using 10.0! You willl also have to add /gen-interface under Command Line > Additional Options. This may not work well in that old release.
0 Kudos
simonwoodward
Beginner
1,611 Views
What does that do? I added it and now I'm getting a fatal error (Code 1) on the first line of the code, which is a comment line.
0 Kudos
Steven_L_Intel1
Employee
1,611 Views
In version 10 (which is several years old), that would cause the creation of generated interfaces that the /warn:interface option would check. In the current version 12 (aka Intel Visual Fortran Composer XE 2011), /warn:interface implies /gen-interface.

There were many bugs related to this feature in earlier versions of the compiler, and you evidently hit one. Please obtain and use a current compiler version for best results.
0 Kudos
Reply