When building gcc 10.2.0 using previous gcc 9.3.0 on a mips64 host, gcc 10.2.0 crashes while building stage3: during IPA pass: sra In file included from /home/buildozer/aports/main/gcc/src/gcc-10.2.0/gcc/cp/method.c:3199: ./gt-cp-method.h:36:2: internal compiler error: Segmentation fault 36 | }; | ^ 0x1208017a3 crash_signal /home/buildozer/aports/main/gcc/src/gcc-10.2.0/gcc/toplev.c:328 0x12041ef55 cgraph_edge::redirect_callee(cgraph_node*) /home/buildozer/aports/main/gcc/src/gcc-10.2.0/gcc/cgraph.c:1374 0x120431cd3 cgraph_edge::redirect_callee_duplicating_thunks(cgraph_node*) /home/buildozer/aports/main/gcc/src/gcc-10.2.0/gcc/cgraphclones.c:262 0x120432167 cgraph_node::create_clone(tree_node*, profile_count, bool, vec<cgraph_edge*, va_heap, vl_ptr>, bool, cgraph_node*, ipa_param_adjustments*, char const*) /home/buildozer/aports/main/gcc/src/gcc-10.2.0/gcc/cgraphclones.c:427 0x12043258b cgraph_node::create_virtual_clone(vec<cgraph_edge*, va_heap, vl_ptr>, vec<ipa_replace_map*, va_gc, vl_embed>*, ipa_param_adjustments*, char const*, unsigned int) /home/buildozer/aports/main/gcc/src/gcc-10.2.0/gcc/cgraphclones.c:613 0x1205eba27 process_isra_node_results /home/buildozer/aports/main/gcc/src/gcc-10.2.0/gcc/ipa-sra.c:3811 0x1205eba27 ipa_sra_analysis /home/buildozer/aports/main/gcc/src/gcc-10.2.0/gcc/ipa-sra.c:4047 0x1205eba27 execute /home/buildozer/aports/main/gcc/src/gcc-10.2.0/gcc/ipa-sra.c:4099 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Full log of building cp/method.o: https://distfiles.dereferenced.org/method.log method.ii: https://distfiles.dereferenced.org/method.ii Unfortunately I wouldn't know where to begin creating a reduced test case for this. Sorry. I suspect the issue is because `caller` is null, which means to->check_calls_comdat_local_p() does a null dereference when trying to fetch the vtable. But I could be wrong entirely. :)
Manually compiling cp/method.o using: g++ -c -o cp/method.o -O2 method.ii works fine. I wonder if this is somehow related to pre-compiled headers, actually.
(In reply to Ariadne Conill from comment #1) > Manually compiling cp/method.o using: > > g++ -c -o cp/method.o -O2 method.ii Can you please try it will all the original arguments: -march=mips3 -mtune=mips64 -mabi=64 -msoft-float -mllsc -mips3 -mno-shared -auxbase-strip cp/method.o -Os -Wextra -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wsuggest-attribute=format -Woverloaded-virtual -Wpedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -version -fno-PIE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -fomit-frame-pointer > > works fine. > > I wonder if this is somehow related to pre-compiled headers, actually. If I see correctly, pre-compiled headers are not used in your case.
When that method.ii is compiled against g++ 9.3.0 with the provided options, it compiles successfully. When built using a cross-compiled g++ 10.2.0, it crashes. So, the issue is specific to 10.2.0 it seems.
(In reply to Ariadne Conill from comment #3) > When that method.ii is compiled against g++ 9.3.0 with the provided options, > it compiles successfully. > > When built using a cross-compiled g++ 10.2.0, it crashes. So, the issue is > specific to 10.2.0 it seems. I've just tried building 10.2.0 cross compiler (x86_64-linux-gnu as host) and I can't reproduce it. Which options do you use?
I should clarify. I cross-compiled g++ 10.2.0 to run on mips64 *host*. That part worked fine. Afterwards, the *host* mips64 g++ cannot compile itself. The *host* mips64 g++ (which was cross-compiled from an aarch64 machine), is built with: Configured with: /home/buildozer/aports/main/gcc/src/gcc-10.2.0/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --build=mips64-alpine-linux-musl --host=mips64-alpine-linux-musl --target=mips64-alpine-linux-musl --with-pkgversion='Alpine 10.2.0' --enable-checking=release --disable-fixed-point --disable-libstdcxx-pch --disable-multilib --disable-nls --disable-werror --disable-symvers --enable-__cxa_atexit --enable-default-pie --enable-default-ssp --enable-cloog-backend --enable-languages=c,c++,d,objc,fortran,ada --with-arch=mips3 --with-tune=mips64 --with-mips-plt --with-float=soft --with-abi=64 --disable-bootstrap --disable-libquadmath --disable-libssp --disable-libmpx --disable-libmudflap --disable-libsanitizer --enable-shared --enable-threads --enable-tls --disable-libitm --with-system-zlib --with-linker-hash-style=sysv So we have this crashing whenever we try to build gcc with 10.2.0 on a mips64 host, either rebuilding from gcc 9.3.0 or from cross-compiled 10.2.0.
(In reply to Ariadne Conill from comment #5) > I should clarify. > > I cross-compiled g++ 10.2.0 to run on mips64 *host*. That part worked fine. > > Afterwards, the *host* mips64 g++ cannot compile itself. > > The *host* mips64 g++ (which was cross-compiled from an aarch64 machine), is > built with: > > Configured with: /home/buildozer/aports/main/gcc/src/gcc-10.2.0/configure > --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info > --build=mips64-alpine-linux-musl --host=mips64-alpine-linux-musl > --target=mips64-alpine-linux-musl --with-pkgversion='Alpine 10.2.0' > --enable-checking=release --disable-fixed-point --disable-libstdcxx-pch > --disable-multilib --disable-nls --disable-werror --disable-symvers > --enable-__cxa_atexit --enable-default-pie --enable-default-ssp > --enable-cloog-backend --enable-languages=c,c++,d,objc,fortran,ada > --with-arch=mips3 --with-tune=mips64 --with-mips-plt --with-float=soft > --with-abi=64 --disable-bootstrap --disable-libquadmath --disable-libssp > --disable-libmpx --disable-libmudflap --disable-libsanitizer --enable-shared > --enable-threads --enable-tls --disable-libitm --with-system-zlib > --with-linker-hash-style=sysv > > So we have this crashing whenever we try to build gcc with 10.2.0 on a > mips64 host, either rebuilding from gcc 9.3.0 or from cross-compiled 10.2.0. An easy way to observe the behavior for yourself would be to use an Alpine chroot on a mips64 host (I think the GCC build farm has one, if not, I can facilitate access to a mips64 container).
I was able to reproduce using latest commit from gcc 10 branch: /home/ncopa/aports/main/gcc/src/build/./prev-gcc/xg++ -B/home/ncopa/aports/main/gcc/src/build/./prev-gcc/ -B/usr/mips64-alpine-linux-musl/bin/ -nostdinc++ -B/home/ncopa/aports/main/gcc/src/build/prev-mips64-alpine-linux-musl/libstdc++-v3/src/.libs -B/home/ncopa/aports/main/gcc/src/build/prev-mips64-alpine-linux-musl/libstdc++-v3/libsupc++/.libs -I/home/ncopa/aports/main/gcc/src/build/prev-mips64-alpine-linux-musl/libstdc++-v3/include/mips64-alpine-linux-musl -I/home/ncopa/aports/main/gcc/src/build/prev-mips64-alpine-linux-musl/libstdc++-v3/include -I/home/ncopa/aports/main/gcc/src/gcc-10.2.1/libstdc++-v3/libsupc++ -L/home/ncopa/aports/main/gcc/src/build/prev-mips64-alpine-linux-musl/libstdc++-v3/src/.libs -L/home/ncopa/aports/main/gcc/src/build/prev-mips64-alpine-linux-musl/libstdc++-v3/libsupc++/.libs -fno-PIE -c -DIN_GCC_FRONTEND -g -O2 -fno-checking -gtoggle -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -Icp -I/home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc -I/home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/cp -I/home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/../include -I/home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/../libcpp/include -I/home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/../libdecnumber -I/home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/../libdecnumber/dpd -I../libdecnumber -I/home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/../libbacktrace -Os -fomit-frame-pointer -o cp/method.o -MT cp/method.o -MMD -MP -MF cp/.deps/method.TPo /home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/cp/method.c during IPA pass: sra In file included from /home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/cp/method.c:3199: ./gt-cp-method.h:36:2: internal compiler error: Segmentation fault 36 | }; | ^ 0x120807513 crash_signal /home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/toplev.c:328 0x1204210f5 cgraph_edge::redirect_callee(cgraph_node*) /home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/cgraph.c:1374 0x1204340c3 cgraph_edge::redirect_callee_duplicating_thunks(cgraph_node*) /home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/cgraphclones.c:262 0x120434557 cgraph_node::create_clone(tree_node*, profile_count, bool, vec<cgraph_edge*, va_heap, vl_ptr>, bool, cgraph_node*, ipa_param_adjustments*, char const*) /home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/cgraphclones.c:427 0x12043497b cgraph_node::create_virtual_clone(vec<cgraph_edge*, va_heap, vl_ptr>, vec<ipa_replace_map*, va_gc, vl_embed>*, ipa_param_adjustments*, char const*, unsigned int) /home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/cgraphclones.c:613 0x1205ee357 process_isra_node_results /home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/ipa-sra.c:3811 0x1205ee357 ipa_sra_analysis /home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/ipa-sra.c:4047 0x1205ee357 execute /home/ncopa/aports/main/gcc/src/gcc-10.2.1/gcc/ipa-sra.c:4099 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. make: *** [Makefile:1117: cp/method.o] Error 1 Withs some help from Ariadne we figured out that it passes with -O1 it fails with -O2 (or -Os) it fails with -O1 -fipa-sra -fpartial-inlining it fails with -Og -fipa-sra -fpartial-inlining it passes with -Og -fipa-sra it passes with -Og -fpartial-inlining it passes with -O2 and either -fnoipa-sra or -fnopartial-inlining it passes with -fipa-sra -fpartial-inlining So it seems that it is some -Og optimization in combination with -fipa-sra -fpartial-inlining triggers it. I have not been able to pinpoint any of the documented -O1 or -Og optimization flags. It fails with: -Og -fipa-sra -fpartial-inlining -fno-combine-stack-adjustments -fno-compare-elim -fno-cprop-registers -fno-defer-pop -fno-ipa-profile -fno-ipa-pure-const -fno-ipa-reference -fno-ipa-reference-addressable -fno-merge-constants -fno-omit-frame-pointer -fno-reorder-blocks -fno-shrink-wrap -fno-split-wide-types -fno-tree-builtin-call-dce -fno-tree-ccp -fno-tree-ch -fno-tree-coalesce-vars -fno-tree-copy-prop -fno-tree-dce -fno-tree-dominator-opts -fno-tree-fre -fno-tree-sink -fno-tree-slsr -fno-tree-ter
All right, there's a compile farm mips64 machine gcc24 so I'll try it there..
g++ -std=c++11 -fno-PIE -c -g -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include -I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/../libbacktrace -o calls.o -MT calls.o -MMD -MP -MF ./.deps/calls.TPo ../../gcc/calls.c /bin/bash: line 1: 7006 Killed build/genautomata ../../gcc/common.md ../../gcc/config/mips/mips.md insn-conditions.md > tmp-automata.c make[3]: *** [Makefile:2399: s-automata] Error 137 So I won't be able to help you :/
All right, I have a reduced test-case (with the failing stage1 compiler): $ cat method.ii typedef union tree_node *tree; struct tree_typed { tree type; }; struct tree_type_non_common { tree lang_1; }; union tree_node { tree_typed typed; tree_type_non_common type_non_common; }; ; struct comp_info { bool noex; comp_info(tree fndecl, int ) { if (noex) { if ((((((fndecl)->typed.type)))->type_non_common.lang_1) ) noex = false; } } }; tree build_comparison_op_fndecl; int build_comparison_op_complain; void synthesize_method() { { { comp_info (build_comparison_op_fndecl, build_comparison_op_complain); } } }
Apparently, it's gone.