[Bug c++/85618] New: Zero initialized non constant stack array causes internal compile error

zefzsoftwares at hotmail dot com gcc-bugzilla@gcc.gnu.org
Wed May 2 19:12:00 GMT 2018


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

            Bug ID: 85618
           Summary: Zero initialized non constant stack array causes
                    internal compile error
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zefzsoftwares at hotmail dot com
  Target Milestone: ---

Following code to reproduce compile error:

  void function(int size) {
     bool myArray[size][size] = {};
  }

Compilation example: https://godbolt.org/g/VfDvsr

Fails with the following error:
"
  during RTL pass: expand

  <source>: In function 'void function(std::vector<int>)':

  <source>:4:9: internal compiler error: in make_decl_rtl, at varasm.c:1322

      bool myArray[arg.size()][arg.size()] = {};

           ^~~~~~~

  mmap: Invalid argument
"

Removing the = {} initializer and using a memset() instead is a work-around.
Regression bug since it compiles fine with GCC 7


More information about the Gcc-bugs mailing list