Skip to content

List of possible bugs found by automated code analysis #17012

Open

Description

@jakobjakobson13

I ran an automated code analysis by https://www.deepcode.ai/ and the AI found the following bugs. I'm not sure if all of them are serious or important but if two or three code improvements can be made, that's something at least.

Activity

  1. charris commented on Aug 4, 2020

    @charris
    Member

    Most of these look reasonable. Note that we no longer support Python < 3.6, the lapack_lite code is generated by translation from Fortran, and there are compatibility macros in numpy/core/include/numpy/npy_3kcompat.h. I don't know if it is easy for you to use the latter or select the Python versions.

  2. charris commented on Aug 4, 2020

    @charris
    Member

    "Use sorted(). sort [:162] sorts in-place and returns None. == [:162] expects a value."

    This is not a bug, the == operator applies element wise to the sorted arrays. Could be made nicer perhaps.

    EDIT: sorted returns a list when applied to arrays. Hmm...

    In [5]: type(sorted(arange(5)))                                                 
    Out[5]: list
    
  3. eric-wieser commented on Aug 5, 2020

    @eric-wieser
    Member

    I've edited the issue text to cross out the cases we've deemed invalid, along with a reason.

  4. bashtage commented on Aug 5, 2020

    @bashtage
    Contributor

    7 is clearly wrong. The negation is valid and intentional.

  5. eric-wieser commented on Aug 5, 2020

    @eric-wieser
    Member

    @bashtage, I've no idea what -bound % bound actually does when bound is an unsigned integer

  6. bashtage commented on Aug 5, 2020

    @bashtage
    Contributor

    Same as (-bound) % bound for an unsigned type. Reflect it around, then find the modulus.

    This code is never used and could be removed FWIW.

  7. bashtage commented on Aug 5, 2020

    @bashtage
    Contributor

    FWIW the idea in this code is to find the amount of a uint64 that is left over after that largest integer divisor, and then remove this from when sampling a bounded integer to produce an unbiased sample.

  8. eric-wieser commented on Aug 5, 2020

    @eric-wieser
    Member

    That last comment might be helpful written in the code.

  9. jakobjakobson13 commented on Aug 9, 2020

    @jakobjakobson13
    ContributorAuthor

    I've edited the issue text to cross out the cases we've deemed invalid, along with a reason.

    I could fix the easy ones (number 1, 12, 13, 14, 15, 16, 18, 19, 20, 22, 27, 28, 32, 35) with the given hints but I don't want to mess with your code. So, should I take action?

  10. seberg commented on Aug 9, 2020

    @seberg
    Member

    @jakobjakobson13 sure, PRs are always welcome, if you have time, look at our style guides, etc. but for these small things, I think you can really just go ahead and make a PR. If there are things to fix up, they will be flushed out during review.

  11. eric-wieser commented on Aug 10, 2020

    @eric-wieser
    Member

    As far as I can tell 20 is nonsense, ret cannot be NULL on that line.

  12. rossbar commented on Aug 11, 2020

    @rossbar
    Contributor

    @jakobjakobson13 I've reformatted your list in the top comment to be a check list. Can you please double check that the bullets that have been addressed (either with a merged PR, or with a review that decided the change was unnecessary) have been checked? This will give us a clear "definition of done" for the issue to indicate when we can close it.

  13. bashtage commented on Aug 11, 2020

    @bashtage
    Contributor

    7 should be ticked and 9 is silly since it is only being used to have a negligible prob of a collision.

  14. melissawm commented on Sep 24, 2020

    @melissawm
    Member

    23 might be solved by #17373, please let me know if it isn't!

  15. melissawm commented on Sep 24, 2020

    @melissawm
    Member

    I think 10 is not relevant since these variables are reset at some point in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions