[Bug target/96072] ICE: Segmentation fault (in add_reg_note)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96072 --- Comment #1 from Arseny Solokha --- testsuite/gcc.target/s390/20041109-1.c is another similar case which clobbers SP on PowerPC. Maybe it's time to turn warning: listing the stack pointer register 'sp' in a clobber list is deprecated into a hard error and be done with it?
[Bug target/96072] ICE: Segmentation fault (in add_reg_note)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96072 --- Comment #2 from Arseny Solokha --- Finally, yet another testcase which also plays games w/ SP but, unlike the previous two, does not involve its "manual" manipulation. void he (int jn) { { int bh[jn]; if (jn != 0) goto wa; } wa: ; }
[Bug target/96072] ICE: Segmentation fault (in add_reg_note)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96072 Segher Boessenkool changed: What|Removed |Added CC||segher at gcc dot gnu.org Status|UNCONFIRMED |WAITING Ever confirmed|0 |1 Last reconfirmed||2022-09-13 --- Comment #3 from Segher Boessenkool --- None of these ICE, not at any optimisation level, for no Linux ABI. Is this fixed, are any special options needed?
[Bug target/96072] ICE: Segmentation fault (in add_reg_note)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96072 --- Comment #4 from Arseny Solokha --- They still ICE for me. % powerpc-e300c3-linux-gnu-gcc-13.0.0 -v Using built-in specs. COLLECT_GCC=powerpc-e300c3-linux-gnu-gcc-13.0.0 COLLECT_LTO_WRAPPER=/usr/libexec/gcc/powerpc-e300c3-linux-gnu/13.0.0/lto-wrapper Target: powerpc-e300c3-linux-gnu Configured with: /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220911/work/gcc-13-20220911/configure --host=x86_64-pc-linux-gnu --target=powerpc-e300c3-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/powerpc-e300c3-linux-gnu/gcc-bin/13.0.0 --includedir=/usr/lib/gcc/powerpc-e300c3-linux-gnu/13.0.0/include --datadir=/usr/share/gcc-data/powerpc-e300c3-linux-gnu/13.0.0 --mandir=/usr/share/gcc-data/powerpc-e300c3-linux-gnu/13.0.0/man --infodir=/usr/share/gcc-data/powerpc-e300c3-linux-gnu/13.0.0/info --with-gxx-include-dir=/usr/lib/gcc/powerpc-e300c3-linux-gnu/13.0.0/include/g++-v13 --with-python-dir=/share/gcc-data/powerpc-e300c3-linux-gnu/13.0.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --disable-nls --disable-libunwind-exceptions --enable-checking=yes --disable-esp --enable-libstdcxx-time --disable-libstdcxx-pch --enable-poison-system-directories --with-sysroot=/usr/powerpc-e300c3-linux-gnu --disable-bootstrap --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libssp --disable-libada --disable-cet --disable-systemtap --enable-valgrind-annotations --disable-vtable-verify --disable-libvtv --without-zstd --enable-lto --with-isl --disable-isl-version-check --disable-libsanitizer --enable-default-ssp Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.0 20220911 (experimental) (GCC) % powerpc-e300c3-linux-gnu-gcc-13.0.0 -Q --help=target The following options are target specific: -G8 -m32 [enabled] -m64 [disabled] -mabi=altivec [disabled] -mabi=d32 [enabled] -mabi=d64 [disabled] -mabi=elfv1 [disabled] -mabi=elfv2 [disabled] -mabi=ibmlongdouble [enabled] -mabi=ieeelongdouble [disabled] -mabi=no-altivec [enabled] -mabi=vec-default [enabled] -mabi=vec-extabi [disabled] -mads [disabled] -maix-struct-return [enabled] -malign- natural -malign-branch-targets -mallow-movmisalign [disabled] -maltivec [disabled] -malways-hint -mavoid-indexed-addresses [disabled] -mbig [enabled] -mbig-endian [enabled] -mbionic [disabled] -mbit-align [disabled] -mbit-word[disabled] -mblock-compare-inline-limit= 63 -mblock-compare-inline-loop-limit=-1 -mblock-move-inline-limit=32 -mblock-ops-unaligned-vsx [disabled] -mblock-ops-vector-pair [disabled] -mbss-plt [disabled] -mcall-ABIlinux -mcmodel= small -mcmpb[disabled] -mcompat-align-parm [disabled] -mcpu=[default] -mcrypto [disabled] -mdebug= -mdirect-move [disabled] -mdlmzb [disabled] -meabi[disabled] -mefficient-unaligned-vsx [disabled] -memb [disabled] -mfloat128[disabled] -mfloat128-convert[disabled] -mfloat128-hardware [disabled] -mfp-in-toc [enabled] -mfprnd [disabled] -mfriz -mfull-toc[disabled] -mfused-madd -ffp-contract=fast -mgen-cell-microcode [ignored] -mglibc [enabled] -mgnu-attribute [enabled] -mhard-dfp[disabled] -mhard-float [enabled] -mhtm [disabled] -mieee128-constant[enabled] -minsert-sched-nops= -misel[disabled] -mlittle
[Bug target/96072] ICE: Segmentation fault (in add_reg_note)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96072 Kewen Lin changed: What|Removed |Added CC||linkw at gcc dot gnu.org Status|WAITING |NEW --- Comment #5 from Kewen Lin --- Confirmed. if (DEFAULT_ABI == ABI_V4 || flag_shrink_wrap) { /* If the frame pointer was used then we can't delay emitting a REG_CFA_DEF_CFA note. This must happen on the insn that restores the frame pointer, r31. We may have already emitted a REG_CFA_DEF_CFA note, but that's OK; A duplicate is discarded by dwarf2cfi.cc/dwarf2out.cc, and in any case would be harmless if emitted. */ if (frame_pointer_needed) { insn = get_last_insn (); add_reg_note (insn, REG_CFA_DEF_CFA, plus_constant (Pmode, frame_reg_rtx, frame_off)); RTX_FRAME_RELATED_P (insn) = 1; } ICE since the insn here is (rtx) 0x0. I think the code here has the assumption that the frame pointer restoring happened ahead, it's: /* If we have a frame pointer, we can restore the old stack pointer from it. */ else if (frame_pointer_needed_indeed) { frame_reg_rtx = sp_reg_rtx;
[Bug target/96072] ICE: Segmentation fault (in add_reg_note)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96072 Kewen Lin changed: What|Removed |Added CC||bergner at gcc dot gnu.org --- Comment #6 from Kewen Lin --- diff --git a/gcc/config/rs6000/rs6000-logue.cc b/gcc/config/rs6000/rs6000-logue.cc index 59fe1c8cb8b..a868ede24fb 100644 --- a/gcc/config/rs6000/rs6000-logue.cc +++ b/gcc/config/rs6000/rs6000-logue.cc @@ -4924,7 +4924,7 @@ rs6000_emit_epilogue (enum epilogue_type epilogue_type) a REG_CFA_DEF_CFA note, but that's OK; A duplicate is discarded by dwarf2cfi.cc/dwarf2out.cc, and in any case would be harmless if emitted. */ - if (frame_pointer_needed) + if (frame_pointer_needed_indeed) { insn = get_last_insn (); add_reg_note (insn, REG_CFA_DEF_CFA, The above diff can fix the issue, I think it's related to commit r10-7981, which introduced frame_pointer_needed_indeed but missed to update the condition for adding reg note under new flag.