- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using -diag-enable sc3 to identify issues on my code.
I would like to know if the following warning is OK, as I can't really understand it.
Basically, the code has a variable used to handle potential errors.
I'm initializing the variable to something, then putting on it the return code of the well-known printf function.
Before ending, the code returns the content of that variable as program status.
My code is the following. I first stepped into this issue with a regular function, not actually main(). But it was reproducible also there.
#includeint main(){int ret = EINVAL;ret = printf("");return ret;}
And the output is the following.
2178 8 main.c(5): warning #12178: this value of "ret" isn't used in the program /tmp/main.c 5 ret main 1
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
did you compile with optimization? I'd recommend to turn off optimizations (-O0) as they can have negative influence on the analysis. As a result you're going to see more "false positives". Those are findings in your reports that are no problems at all.
My recommendation would be those options for the build: "-g -O0".
Please keep in mind that the Intel Static Security Analysis tool will eventually bring up lots of findings. Because of static analysis principles it cannot always judge the real severity of the findings. Hence you have to decide by sighting. Using Intel Inspector XE to manage the reports you can apply filters and suppression rules.
Best regards,
Georg Zitzlsberger
did you compile with optimization? I'd recommend to turn off optimizations (-O0) as they can have negative influence on the analysis. As a result you're going to see more "false positives". Those are findings in your reports that are no problems at all.
My recommendation would be those options for the build: "-g -O0".
Please keep in mind that the Intel Static Security Analysis tool will eventually bring up lots of findings. Because of static analysis principles it cannot always judge the real severity of the findings. Hence you have to decide by sighting. Using Intel Inspector XE to manage the reports you can apply filters and suppression rules.
Best regards,
Georg Zitzlsberger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
AWarning #12178 - 'this value of ret isn't used in the program' is not an error or an indication of some
problem. Make your test case more complex and try to useret variable as many as possible times. That
also applies to any functions.
Best regards,
Sergey

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page