Menu

Two minor 2.4 FPs

2021-03-23
2021-03-23
  • Dan Workman

    Dan Workman - 2021-03-23

    Just upgraded to 2.4 and have found two minor False Positives

    The first thinks that zero-initialization of a std::array will empty it and the other claims that a variable is uninitialized even though it is not (I admit the usage is rather odd)

    void fp_1()
    {
      std::array<int, 4> a = {};
      std::cout << a[0]; // warning: Out of bounds access in expression 'a[0]' because 'a' is empty. [containerOutOfBounds]
    }
    
    void fp_2()
    {
      std::stringstream ss("1 2 3 4");
    
      for (int i; ss >> i;) // warning: Uninitialized variable: i [uninitvar]
        std::cout << i;
    }
    
     
  • CHR

    CHR - 2021-03-23

    The first FP should be covered by this.

     
    👍
    1

    Last edit: CHR 2021-03-23
  • CHR

    CHR - 2021-03-23

    Second ticket is here.

     
    👍
    1

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.