- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I tried to run static analysis on my code following the tutorial at http://software.intel.com/sites/products/evaluation-guides/docs/intelparallelstudio-evaluationguide-ssa.pdf during my eval period. When I run it on my code, Inspector XE tells me that it did not detect any problems. To make sure, I inserted a code piece which would cause division by zero and re-compiled all the modules. Unfortunately it still tells me that there are no problems.
To verify my commands and installation, I tried that division by zero error in a brand new project. For that single module project Inspector/compiler could find the problem.
Any idea on what I should check or what I might be doing wrong?
Thanks in advance,
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found that I can detect Division-by-Zero issue, use below simple example:
#include
double mysub(int x, int y) {
return 1 / (x - y);
}
int main(int argc, char **argv) {
int x,y;
if (argc > 3) {
x = 6;
y = 3;
} else {
x = 3;
y = 0;
}
printf("%f\n", mysub(x, y));
return 0;
}
Pleasemodify project property:Diagnostics [Intel C++] \ Level of Static Analysis Result Directory to select: All Error and Warnings (/Qdiag-enable:sc3), then rebuild the project.
>Link:
1> xilink: remark #10336: Static security analysis complete; results available in "My Inspector XE Results - ssa_error\r000sc\r000sc.inspxe"
Youshould see Inspector XE 2011results generated,then you can open it and see below picture.
Regards, Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunately my problem is not, not being able to detect division by zero problems. The problem is that, SSA fails to detect problems in my own project.
Here is a simple example which SSA can run with no problems:
[root@localhost relayer]# cat x.cpp
#include
int main()
{
char *buffer = "bahri";
char tmp[12];
sscanf(buffer, "%s", tmp);
int a=1;
int b=0;
printf("%s - %d\n", tmp, a/b);
return 0;
}
[root@localhost relayer]# icpc -g -Wall -diag-enable sc3 x.cpp
icpc: remark #10336: static security analysis complete; results available in "/relayer/./r007sc/r007sc.inspxe"
[root@localhost relayer]# inspxe-cl -report summary ./r006sc/r006sc.inspxe
Used suppression file(s): []
2 new problem(s) found
1 Divide by zero problem(s) detected
1 Unsafe format specifier problem(s) detected
[root@localhost relayer]# cat ss7relay.cpp
int a = 1;
int b = 0;
printf("%d", a/b);
[root@localhost relayer]# make -f Makefile.intel
icpc -g -Wall -diag-enable sc3 -c -g -Wall -diag-enable sc3 -D__STDC_LIMIT_MACROS -ISOME_INCLUDE_FOLDERS -LSOME_LIBRARY_FOLDERS -o ssa/ss7relay.o ss7relay.cpp
/asn1c/rtsrc/asn1CppTypes.h(174): warning #1125: function "OSRTMessageBufferIF::initBuffer(OSOCTET={OSUINT8={unsigned char}} *, size_t={unsigned int})" is hidden by "ASN1MessageBuffer::initBuffer" -- virtual function override intended?
virtual EXTRTMETHOD int initBuffer (OSRTMEMBUF& membuf);
^
/asn1c/rtsrc/asn1CppTypes.h(186): warning #1125: function "OSRTMessageBufferIF::initBuffer(OSOCTET={OSUINT8={unsigned char}} *, size_t={unsigned int})" is hidden by "ASN1MessageBuffer::initBuffer" -- virtual function override intended?
virtual EXTRTMETHOD int initBuffer (OSUNICHAR* unistr);
^
/asn1c/rtsrc/asn1CppTypes.h(198): warning #1125: function "OSRTMessageBufferIF::initBuffer(OSOCTET={OSUINT8={unsigned char}} *, size_t={unsigned int})" is hidden by "ASN1MessageBuffer::initBuffer" -- virtual function override intended?
virtual int initBuffer (const OSUTF8CHAR* /*str*/) { return RTERR_NOTSUPP; }
^
/asn1c/rtsrc/asn1CppTypes.h(212): warning #1125: function "OSRTMessageBufferIF::isA(int)" is hidden by "ASN1MessageBuffer::isA" -- virtual function override intended?
virtual OSBOOL isA (Type /*bufferType*/) { return FALSE; }
^
/asn1c/rtbersrc/asn1BerCppTypes.h(247): warning #1125: function "ASN1MessageBuffer::isA(OSRTMessageBufferIF::Type)" is hidden by "ASN1BEREncodeBuffer::isA" -- virtual function override intended?
virtual OSBOOL isA (int bufferType) {
^
/asn1c/rtbersrc/asn1BerCppTypes.h(374): warning #1125: function "ASN1MessageBuffer::isA(OSRTMessageBufferIF::Type)" is hidden by "ASN1BERDecodeBuffer::isA" -- virtual function override intended?
virtual OSBOOL isA (int bufferType) {
^
icpc -g -Wall -diag-enable sc3 -g -Wall -diag-enable sc3 -D__STDC_LIMIT_MACROS -ISOME_INCLUDE_FOLDERS -LSOME_LIBRARY_FOLDERS -o ssa/ss7relay_sigtran
icpc: remark #10336: static security analysis complete; results available in "./r000sc/r000sc.inspxe"
[root@localhost relayer]# inspxe-cl -report summary ./r000sc/r000sc.inspxe
Used suppression file(s): []
0 new problem(s) found
When the link completes, it tells me static analysis is complete. When I run inspxe, it tells me there are no problems detected.
Any idea on what I can check?
Thanks again,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I used your case,
[root@localhost relayer]# cat ss7relay.cpp
int a = 1;
int b = 0;
printf("%d", a/b);
icpc -g -Wall -diag-enable sc3-D__STDC_LIMIT_MACROS -ISOME_INCLUDE_FOLDERS -LSOME_LIBRARY_FOLDERS -o ss7relay.o ss7relay.cpp
Compiler reported, "Static security analysis was not performed because of compilation errors.
If I added main() in ss7relay.cpp, the problem has gone and I can get right error detection.
So remove main() from ss7relay.cpp again, and use
icpc -g -Wall -diag-enable sc3 -g -Wall -diag-enable sc3 -D__STDC_LIMIT_MACROS -ISOME_INCLUDE_FOLDERS -LSOME_LIBRARY_FOLDERS -o ss7relay_sigtran/lib/librt.so.1 -lm -lpthread -ldl -lasn1ber -lasn1rt -lrt -lsctp
I got:
icpc: remark #10336: static security analysis complete; results available in "./r000sc/r000sc.inspxe"
But I got Error saying: Cannot find input file. Cannot continue.
Anyway, I will report engineering team and get back to you soon.
Thanks, Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think I mislead you. I did not paste all my ss7relay.cpp module, but just a portion of that module which is added to make sure to have an error to report. I was trying to show you with "
I have too many modules in the project and the anaylsis takes almost 3 hours, resulting "no errors". I suspected lack of enough memory, and tried the analysis with more memory but it failed in the same way again.
To make it clear again, I am not saying the tool cannot detect this error. It just cannot analyse my project with hundreds of modules.
Thanks in advance,
![](/skins/images/7B0AB6865064EAE32B30EC9A4E94B48A/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page