https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124424
Bug ID: 124424
Summary: [16 regression] Stack overflow in DOM when building
libreoffice-25.2.7.2
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: sjames at gcc dot gnu.org
CC: law at gcc dot gnu.org
Target Milestone: ---
-O2 is fine:
```
$ g++ -c ./workdir/CxxObject/cppu/source/uno/lbenv.ii -O3
during GIMPLE pass: dom
/var/tmp/portage/app-office/libreoffice-25.2.7.2-r1/work/libreoffice-25.2.7.2/cppu/source/uno/lbenv.cxx:
In function ‘void uno_dumpEnvironmentByName(void*, rtl_uString*, const char*)’:
/var/tmp/portage/app-office/libreoffice-25.2.7.2-r1/work/libreoffice-25.2.7.2/cppu/source/uno/lbenv.cxx:765:17:
internal compiler error: Segmentation fault
765 | extern "C" void SAL_CALL uno_dumpEnvironmentByName(
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/libexec/gcc/x86_64-pc-linux-gnu/16/cc1plus -fpreprocessed
./workdir/CxxObject/cppu/source/uno/lbenv.ii -quiet -dumpbase lbenv.ii
-dumpbase-ext .ii -mtune=generic -march=x86-64 -mtls-dialect=gnu2 -O3
-foffload-options=-fno-stack-protector -fcf-protection
-foffload-options=-fcf-protection=none -o /tmp/ccR4wjeG.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
```
Backtrace after it's been running for 30s or so (it completes very quickly with
-O2 so this should be enough):
```
#0 0x000055f881a59aea in record_equality (x=<optimized out>, y=<optimized
out>, const_and_copies=0x55f8a7947c90) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-dom.cc:1576
#1 0x000055f881a5a02e in back_propagate_equivalences
(lhs=lhs@entry=0x7fb002d256e0, e=e@entry=0x7fb00348d690,
avail_exprs_stack=avail_exprs_stack@entry=0x55f8a7882f80,
const_and_copies=const_and_copies@entry=0x55f8a7947c90,
domby=domby@entry=0x7ffc72114820) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-dom.cc:1161
#2 0x000055f881a5a04a in back_propagate_equivalences
(lhs=lhs@entry=0x7fb002d4cb00, e=e@entry=0x7fb00348d690,
avail_exprs_stack=avail_exprs_stack@entry=0x55f8a7882f80,
const_and_copies=const_and_copies@entry=0x55f8a7947c90,
domby=domby@entry=0x7ffc72114820) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-dom.cc:1164
#3 0x000055f881a5a04a in back_propagate_equivalences
(lhs=lhs@entry=0x7fb002d4caa8, e=e@entry=0x7fb00348d690,
avail_exprs_stack=avail_exprs_stack@entry=0x55f8a7882f80,
const_and_copies=const_and_copies@entry=0x55f8a7947c90,
domby=domby@entry=0x7ffc72114820) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-dom.cc:1164
#4 0x000055f881a5a04a in back_propagate_equivalences
(lhs=lhs@entry=0x7fb002d4c8f0, e=e@entry=0x7fb00348d690,
avail_exprs_stack=avail_exprs_stack@entry=0x55f8a7882f80,
const_and_copies=const_and_copies@entry=0x55f8a7947c90,
domby=domby@entry=0x7ffc72114820) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-dom.cc:1164
#5 0x000055f881a5a04a in back_propagate_equivalences
(lhs=lhs@entry=0x7fb002d4c370, e=e@entry=0x7fb00348d690,
avail_exprs_stack=avail_exprs_stack@entry=0x55f8a7882f80,
const_and_copies=const_and_copies@entry=0x55f8a7947c90,
domby=domby@entry=0x7ffc72114820) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-dom.cc:1164
#6 0x000055f881a5a04a in back_propagate_equivalences
(lhs=lhs@entry=0x7fb002d4c268, e=e@entry=0x7fb00348d690,
avail_exprs_stack=avail_exprs_stack@entry=0x55f8a7882f80,
const_and_copies=const_and_copies@entry=0x55f8a7947c90,
domby=domby@entry=0x7ffc72114820) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-dom.cc:1164
#7 0x000055f881a5a04a in back_propagate_equivalences
(lhs=lhs@entry=0x7fb002d4c160, e=e@entry=0x7fb00348d690,
avail_exprs_stack=avail_exprs_stack@entry=0x55f8a7882f80,
const_and_copies=const_and_copies@entry=0x55f8a7947c90,
domby=domby@entry=0x7ffc72114820) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-dom.cc:1164
[...]
#38 0x000055f881a5a04a in back_propagate_equivalences
(lhs=lhs@entry=0x7fb002d23aa8, e=e@entry=0x7fb00348d690,
avail_exprs_stack=avail_exprs_stack@entry=0x55f8a7882f80,
const_and_copies=const_and_copies@entry=0x55f8a7947c90,
domby=domby@entry=0x7ffc72114820) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-dom.cc:1164
#39 0x000055f881a61440 in record_temporary_equivalences (e=0x7fb00348d690,
const_and_copies=<optimized out>, avail_exprs_stack=<optimized out>,
blocks_on_stack=0x7ffc72114820)
at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-dom.cc:1247
#40 dom_jt_state::register_equivs_edge (this=0x7ffc72114800, e=0x7fb00348d690)
at /usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-dom.cc:741
#41 0x000055f881be4aaa in jump_threader::thread_through_normal_block
(this=0x7ffc721147e0, path=0x55f8a7f33450, e=0x7fb00348d690,
visited=0x7ffc72114660, limit=@0x7ffc7211465c: 63)
at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-threadedge.cc:796
#42 jump_threader::thread_across_edge (this=0x7ffc721147e0, e=0x7fb00348d690)
at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-threadedge.cc:975
#43 0x000055f881be4ddb in jump_threader::thread_outgoing_edges (this=<optimized
out>, bb=<optimized out>) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-threadedge.cc:1118
#44 0x000055f881a59439 in dom_opt_dom_walker::after_dom_children
(this=0x7ffc72114840, bb=0x7fb004047540) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-dom.cc:1823
#45 0x000055f883069489 in dom_walker::walk (this=0x7ffc72114840,
bb=0x7fb004047540) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/domwalk.cc:354
#46 0x000055f881a6083d in (anonymous namespace)::pass_dominator::execute
(this=0x55f8a73d5be0, fun=0x7fb007342820) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-ssa-dom.cc:939
#47 0x000055f8816bc8ab in execute_one_pass (pass=0x55f8a73d5be0) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/passes.cc:2656
#48 0x000055f8816bd6bc in execute_pass_list_1 (pass=0x55f8a73d5be0) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/passes.cc:2769
#49 0x000055f8816bdbc8 in execute_pass_list_1 (pass=0x55f8a73d3250) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/passes.cc:2770
#50 execute_pass_list (fn=0x7fb007342820, pass=<optimized out>) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/passes.cc:2780
#51 0x000055f8810c474f in cgraph_node::expand (this=0x7fb007388aa0) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/context.h:49
#52 0x000055f8810c7b59 in expand_all_functions () at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/cgraphunit.cc:2057
#53 symbol_table::compile (this=this@entry=0x7fb00fa06000) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/cgraphunit.cc:2435
#54 0x000055f8810ca423 in symbol_table::compile (this=0x7fb00fa06000) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/cgraphunit.cc:2348
#55 symbol_table::finalize_compilation_unit (this=0x7fb00fa06000) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/cgraphunit.cc:2626
#56 0x000055f88189250c in compile_file () at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/toplev.cc:482
#57 0x000055f880ad8395 in do_compile () at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/toplev.cc:2229
#58 toplev::main (this=0x7ffc72114da6, argc=<optimized out>, argv=<optimized
out>) at
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/toplev.cc:2393
```
```
Using built-in specs.
COLLECT_GCC=cc
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-languages=c,c++,d,fortran,ada,jit --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
fce599abdf3636cf28c4f3396bb8c889166553a9' --with-gcc-major-version-only
--enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch
--enable-linker-build-id --enable-libada --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --with-tls=gnu2 --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-cet --enable-systemtap --disable-valgrind-annotations
--disable-valgrind-interop --disable-vtable-verify --disable-libvtv --with-zstd
--without-isl --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-host-shared
--enable-libgdiagnostics --disable-bootstrap --with-build-config='bootstrap-O3
bootstrap-cet'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.1 20260304 (experimental)
477a1ff545a5e0d2b49f117fae49797d5405c4f9 (Gentoo Hardened 16.0.9999 p, commit
fce599abdf3636cf28c4f3396bb8c889166553a9)
```