Jump to content
sumit_tuwien

Static Analyzer Report of SystemC-2.3.2

Recommended Posts

Hello All,

I ran static analysis on latest SystemC library [For Fun]. clang-tidy report looks fine (I gave a very fast look). clang++ --analyze produced followed warnings which I want to point out:

warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Refer to --analyzer-output for valid output formats
In file included from ../src/sysc/datatypes/int/sc_int_base.cpp:66:
../src/sysc/datatypes/int/sc_int_base.h:574:22: warning: The result of the left shift is undefined because the left operand is negative
            m_val = ( m_val << m_ulen >> m_ulen );
                      ~~~~~~^~~~~~~~~
1 warning generated.
../src/sysc/utils/sc_mempool.cpp:252:59: warning: Division by zero
    int which_allocator = cell_size_to_allocator[(sz - 1) / increment + 1];
                                                 ~~~~~~~~~^~~~~~~~~~~
1 warning generated.
warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Refer to --analyzer-output for valid output formats
warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Refer to --analyzer-output for valid output formats
warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Refer to --analyzer-output for valid output formats
../src/sysc/utils/sc_string.cpp:181:19: warning: Use of memory after it is freed
    return strlen(rep->str);
                  ^~~~~~~~
../src/sysc/utils/sc_string.cpp:242:9: warning: Use of memory after it is freed
    if (--(rep->ref_count) == 0)
        ^~~~~~~~~~~~~~~~~~
../src/sysc/utils/sc_string.cpp:357:9: warning: Use of memory after it is freed
    if (rep->ref_count > 1) {
        ^~~~~~~~~~~~~~
3 warnings generated.
warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Refer to --analyzer-output for valid output formats
In file included from ../src/sysc/kernel/sc_simcontext.cpp:32:
In file included from ../src/sysc/kernel/sc_simcontext_int.h:37:
../src/sysc/kernel/sc_runnable_int.h:464:18: warning: Called C++ object pointer is null
        m_methods_pop = m_methods_push_head->next_runnable();
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Even if these will not pose a problem for running simulations, I will get my sanitizer and other tools irked out. Following is the script if anybody want to try.

set x = `find ../src -name "*.cpp"`

foreach item ($x)
   /home/sumit/local/clang/bin/clang-tidy \
   -checks='*' \
   `echo ${item}`  \
   -extra-arg=-std=c++17 -- -I ../src
end

/home/sumit/local/clang/bin/clang++ --analyze -std=c++17 -I ../src \
`echo $x`

Please let me know, if there is further questions.

Regards,

Sumit

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...