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

            Bug ID: 121962
           Summary: [16 regression] OOM when buiding clang-19.1.7
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: compile-time-hog, memory-hog
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: pinskia at gcc dot gnu.org
  Target Milestone: ---

Got an OOM overnight (and reproduced it) when building clang-19.1.7. New
copyprop patches?

Taking a backtrace partway through once it had allocated ~5GB (double any other
g++ process when building Clang at the time):
```
location_wrapper_p (exp=<optimized out>, exp=<optimized out>) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree.h:4501
4501           || TREE_CODE (exp) == VIEW_CONVERT_EXPR)
(gdb) bt
#0  location_wrapper_p (exp=<optimized out>, exp=<optimized out>) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree.h:4501
#1  tree_nop_conversion (exp=0x7fcf98f89640) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree.cc:12311
#2  tree_strip_nop_conversions (exp=0x7fcf98f89640) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree.cc:12349
#3  0x0000556987722191 in operand_compare::operand_equal_p(tree_node*,
tree_node const*, tree_node*, tree_node const*, unsigned int) [clone
.constprop.1] (
    this=0x556988d0d5f0 <_ZL24default_compare_instance.lto_priv.0>,
type0=<optimized out>, arg0=0x7fd0a5434030, type1=0x7fd0a53a5c78,
arg1=0x7fcf98f89640, flags=16)
    at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/fold-const.cc:3312
#4  0x0000556986a3ce8d in operand_compare::operand_equal_p (this=<optimized
out>, arg0=0x7fd0a5434030, arg1=0x7fcf98f89640, flags=16)
    at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/fold-const.cc:3199
#5  operand_compare::verify_hash_value (this=<optimized out>,
arg0=0x7fd0a5434030, arg1=0x7fcf98f89640, flags=0, ret=<synthetic pointer>)
    at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/fold-const.cc:4311
#6  operand_compare::verify_hash_value (this=<optimized out>,
arg0=0x7fd0a5434030, arg1=0x7fcf98f89640, flags=0, ret=<synthetic pointer>)
    at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/fold-const.cc:4303
#7  operand_compare::operand_equal_p(tree_node*, tree_node const*, tree_node*,
tree_node const*, unsigned int) [clone .constprop.0] (type0=0x7fd0a5285e70,
arg0=<optimized out>,
    type1=<optimized out>, arg1=0x7fcf98f89640, flags=0, this=<optimized out>)
at /usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/fold-const.cc:3213
#8  0x00005569877ce2a7 in optimize_agr_copyprop_1 (stmt=0x7fd0a606ec08,
use_stmt=0x7fd09b9a7ec8, dest=0x7fd0a5434030, src=0x7fd0a28ce6e0)
    at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-forwprop.cc:1483
#9  0x0000556986edfb55 in optimize_agr_copyprop (gsip=0x7ffe317ab560) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-forwprop.cc:1701
#10 (anonymous namespace)::pass_forwprop::execute (this=<optimized out>,
fun=<optimized out>) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-forwprop.cc:5257
#11 0x0000556984a6f0a6 in execute_one_pass (pass=0x556995fb1110) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/passes.cc:2648
#12 0x0000556986bd4f2c in execute_pass_list_1 (pass=0x556995fb1110) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/passes.cc:2757
#13 0x0000556986bd4f49 in execute_pass_list_1 (pass=0x556995fb0b60) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/passes.cc:2758
#14 0x0000556986bd31d9 in execute_pass_list (fn=0x7fd098d72578, pass=<optimized
out>) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/passes.cc:2768
#15 0x0000556986b4b41a in cgraph_node::expand (this=0x7fd098d97880) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/cgraphunit.cc:1859
#16 0x0000556986a4eccc in expand_all_functions () at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/cgraphunit.cc:2042
#17 symbol_table::compile (this=0x7fd0b4806000) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/cgraphunit.cc:2419
#18 0x000055698774e389 in symbol_table::finalize_compilation_unit
(this=0x7fd0b4806000) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/cgraphunit.cc:2608
#19 0x0000556987705fc0 in compile_file () at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/toplev.cc:480
#20 0x00005569876bdc50 in do_compile () at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/toplev.cc:2220
#21 toplev::main (this=this@entry=0x7ffe317abc36, argc=<optimized out>,
argv=<optimized out>) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/toplev.cc:2383
#22 0x00005569876bcbdd in main (argc=<optimized out>, argv=<optimized out>) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/main.cc:39
```

```
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/16/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-16.0.9999/work/gcc-16.0.9999/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/16
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/16/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/16
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/16/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/16/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/16/python
--enable-libphobos --enable-objc-gc
--enable-languages=c,c++,d,objc,obj-c++,fortran,ada,cobol,m2,rust
--enable-obsolete --enable-secureplt --disable-werror --with-system-zlib
--enable-nls --without-included-gettext --disable-libunwind-exceptions
--enable-checking=yes,extra,rtl --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo Hardened 16.0.9999 p, commit
b77c0ff8641f04bc3844647fdb568f05b6f89a7e' --with-gcc-major-version-only
--enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--enable-multilib --with-multilib-list=m32,mx32,m64 --disable-fixed-point
--with-abi=m64 --enable-targets=all --enable-offload-defaulted
--enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp
--enable-libada --disable-cet --enable-systemtap --enable-valgrind-annotations
--disable-vtable-verify --disable-libvtv --with-zstd --with-isl
--disable-isl-version-check --enable-default-pie --enable-host-pie
--enable-host-bind-now --enable-default-ssp --disable-fixincludes
--with-gxx-libcxx-include-dir=/usr/include/c++/v1 --enable-linker-build-id
--with-build-config='bootstrap-O3 bootstrap-lto'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20250915 (experimental)
597b50abb0d2fc1f123a99e1b4beb89ad6259d9e (Gentoo Hardened 16.0.9999 p, commit
b77c0ff8641f04bc3844647fdb568f05b6f89a7e)
```

Reply via email to