Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Errors using SSA

ipinkas
Beginner
404 Views

Attached is a simple file that demonstrate two failures discovered when running SSA:

  1. SSA failed to detect the memory leak caused by failure to call fclose(). In real code, this would cause a loss of resources (memory and file handles) which would eventually cause a failure.
  2. SSA gives the following error, which appears to be a false positive:

Error 12038: illegal value passed to "fopen_s" in argument 3

I would also like to report a missing option in the on-line documentation. Under Compiler Option Descriptions, the -Qdiag-file option is missing.

0 Kudos
3 Replies
TimP
Honored Contributor III
404 Views
Apparently, you're discussing mainly Inspector XE. That's another forum.

icl -help
.....
/Qdiag-file[:]
where diagnostics are emitted to. Not specifying this causes
messages to be output to stderr
.....

C:\Program Files (x86)\Intel\ComposerXE-2011\Documentation\en_US\compiler_c\cl\index.htm
.....

diag-file, Qdiag-file

Causes the results of diagnostic analysis to be output to a file.

........

I think you'd have to state more explicitly what is missing.


0 Kudos
JenniferJ
Moderator
404 Views
To view the SSA result you need the Inspector XE. To generate the SSA data, you use the Composer XE.

Let me see if we can duplicate the issue here. Thanks for reporting it with a testcase.

Jennifer
0 Kudos
levicki
Valued Contributor I
404 Views
Regarding your point #1 -- no software can be smart enough to detect your intent.

Maybe you left the file open on purpose?
Maybe handle is to a console input or output and should not be closed?
Maybe file pointer is a global variable and you close the file elsewhere?

Since this particular function with missing fclose() is called only once, not doing an explicit fclose() before the program end is not a catastrophic error -- C runtime will close all open handles on exit anyway so there will be no resource leak. If you called it inside of a loop, then not detecting missing fclose() would be a serious issue.
0 Kudos
Reply