https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110395

            Bug ID: 110395
           Summary: GCOV stuck in an infinite loop with large std::array
           Product: gcc
           Version: 9.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: carlosgalvezp at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Hi!

We are bumping from GCC 7.5.0 to GCC 9.4.0 (Ubuntu 20.04) and observe that GCOV
is stuck when analyzing the following minimal repro code:

#include <vector>
#include <array>

template <typename T, std::size_t n>
class StaticVector
{
 public:
    StaticVector() = default;
    void foo(){}

 private:
    std::array<T, n> data{};
};

class Foo
{
    StaticVector<std::vector<std::size_t>, 40000> data_{};
};

int main()
{
    Foo f;
    return 0;
}


$ g++ --coverage main.cpp
$ ./a.out
$ gcov main.cpp

The problem goes away if I remove the value initialization for std::array in
the StaticVector class (i.e. I leave the member "data" uninitialized).

The same problem happens also on GCC 11 

What might be the reason for this? 

Thanks!

Reply via email to