Source Code Analysis does not report errors

If you are using Source Code Analysis, -diag-enable sc (Linux OS and Mac OS X) or /Qdiag-enable:sc (Windows OS), and do not see expected errors reported, it may be because of other compiler options you are using as discussed in the compiler documentation:

Using Source Code Analysis Options with Other Compiler Options
If the -c (Linux OS and Mac OS X) or /c (Windows OS) compiler option is used on
the command line along with a command line option to enable source code analysis,
an object file is created; source code analysis diagnostics are not produced.

For more complete information about compiler optimizations, see our Optimization Notice.