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

            Bug ID: 110078
           Summary: [13 regression] Excessive memory usage constructing
                    std::variant from a high-index alternative.
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: toojays at toojays dot net
  Target Milestone: ---

Created attachment 55233
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55233&action=edit
Reproducer demonstrating excessive memory use constructing std::variant from a
high-index alternative.

The attached source contains a function which constructs a std::variant<29
alternatives> from the 29th alternative. Attempting to compile it with GCC 13.1
results in cc1plus consuming more than 20GiB of memory before being killed. GCC
12.2.0 is able to compile it promptly with no apparent problems.

$ g++-13 -v
Using built-in specs.
COLLECT_GCC=/opt/acacia/3rd-party/gcc-13.1.0-1/bin/g++
COLLECT_LTO_WRAPPER=/opt/acacia/3rd-party/gcc-13.1.0-1/libexec/gcc/x86_64-pc-linux-gnu/13.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /docker-20.04-build/extract/gcc-13.1.0/configure
--prefix=/opt/acacia/3rd-party/gcc-13.1.0-1
CPPFLAGS=-I/opt/acacia/3rd-party/gcc-13.1.0-1/include CFLAGS='-O2 -g
-fno-omit-frame-pointer' CXXFLAGS='-O2 -g -fno-omit-frame-pointer'
--enable-languages=c,c++,d --disable-multilib --with-system-zlib
--enable-checking=release --program-prefix= --program-suffix=
--with-gmp=/opt/acacia/3rd-party/gcc-13.1.0-1
--with-mpfr=/opt/acacia/3rd-party/gcc-13.1.0-1
--with-mpc=/opt/acacia/3rd-party/gcc-13.1.0-1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.0 (GCC)

Reply via email to