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

            Bug ID: 124579
           Summary: g++ hang on when compiling code with huge global
                    arrays
           Product: gcc
           Version: 12.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: oaygnahzz at gmail dot com
  Target Milestone: ---

I have a bug in GCC I'd like to about. If i declare a very large global array,
the gcc compliation will hang.

Reproduction Procedure:
hugearray.cpp

#include <string>
#include <iostream>

typedef struct MessReg
{
uint32_t nindex;
std::string strIndex;
}MessReg;

static MessReg g_MessReg[] = {
{1, "repeat string 1"},
{2, "repeat string 2"},
{3, "repeat string 3"},
......
{65536, "repeat string 65536"},
};

bool test()

{
std::cout << "test" << std::endl;
return true;
}

g++ -fstack-protector-all -c hugearray.cpp -o hugearray.o

Reply via email to