Originally reported by Rolf Eike Beer as a build failure of python-3.6.9: https://bugs.gentoo.org/697708 Here is the minimal reproducer against ghc-master: $ cat bug.c // sparc-unknown-linux-gnu-gcc -O1 -mcpu=niagara2 -fPIE -c bug.c -o bug.o typedef union { double a; int b[2]; } c; double d(int e) { c f; (&f)->b[0] = 15728640; return e ? -(&f)->a : (&f)->a; } $ gcc/xgcc -Bgcc -O1 -mcpu=niagara2 -fPIE -c bug.c -o bug.o during RTL pass: reload bug.c: In function 'd': bug.c:10:1: internal compiler error: Segmentation fault 10 | } | ^ $ gcc/xgcc -Bgcc -v Reading specs from /home/slyfox/dev/git/gcc-sparc/gcc/specs COLLECT_GCC=/home/slyfox/dev/git/gcc-sparc/gcc/xgcc COLLECT_LTO_WRAPPER=/home/slyfox/dev/git/gcc-sparc/gcc/lto-wrapper Target: sparc-unknown-linux-gnu Configured with: ../gcc/configure --target=sparc-unknown-linux-gnu --with-sysroot=/usr/sparc-unknown-linux-gnu --enable-languages=c --disable-bootstrap --prefix=/home/slyfox/dev/git/gcc-sparc/../gcc-sparc-installed --disable-multilib --without-isl cross_compiling=yes Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.0.0 20191014 (experimental) (GCC)
Created attachment 47034 [details] bug.c
I can reproduce. Fails with gcc -m32 -O1 -mcpu=niagara2 -fPIE and GCC 8/9/10. Works with -m64. Works with GCC 7. > gcc/xgcc -Bgcc -m32 -O1 -mcpu=niagara2 -fPIE -S pr92095.c during RTL pass: reload pr92095.c: In function 'd': pr92095.c:10:1: internal compiler error: Segmentation fault 10 | } | ^ 0x596eef crash_signal /mnt/scratch/gcc-10-20191020/gcc/toplev.c:326 0x247100 validize_mem(rtx_def*) /mnt/scratch/gcc-10-20191020/gcc/explow.c:521 0x86c897 sparc_expand_move(machine_mode, rtx_def**) /mnt/scratch/gcc-10-20191020/gcc/config/sparc/sparc.c:2315 0xa68dbf gen_movdf(rtx_def*, rtx_def*) /mnt/scratch/gcc-10-20191020/gcc/config/sparc/sparc.md:2469 0x26d60f insn_gen_fn::operator()(rtx_def*, rtx_def*) const /mnt/scratch/gcc-10-20191020/gcc/recog.h:318 0x26d60f emit_move_insn_1(rtx_def*, rtx_def*) /mnt/scratch/gcc-10-20191020/gcc/expr.c:3727 0x26daa3 emit_move_insn(rtx_def*, rtx_def*) /mnt/scratch/gcc-10-20191020/gcc/expr.c:3823 0x4076c7 lra_emit_move(rtx_def*, rtx_def*) /mnt/scratch/gcc-10-20191020/gcc/lra.c:499 0x419cef curr_insn_transform /mnt/scratch/gcc-10-20191020/gcc/lra-constraints.c:4397 0x41bdab lra_constraints(bool) /mnt/scratch/gcc-10-20191020/gcc/lra-constraints.c:4994 0x407c6f lra(_IO_FILE*) /mnt/scratch/gcc-10-20191020/gcc/lra.c:2432 0x3bf45f do_reload /mnt/scratch/gcc-10-20191020/gcc/ira.c:5511 0x3bf45f execute /mnt/scratch/gcc-10-20191020/gcc/ira.c:5697 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.
I can reproduce.
Investigating.
Author: ebotcazou Date: Fri Nov 8 12:30:47 2019 New Revision: 277966 URL: https://gcc.gnu.org/viewcvs?rev=277966&root=gcc&view=rev Log: PR target/92095 * config/sparc/sparc-protos.h (output_load_pcrel_sym): Declare. * config/sparc/sparc.c (sparc_cannot_force_const_mem): Revert latest change. (got_helper_needed): New static variable. (output_load_pcrel_sym): New function. (get_pc_thunk_name): Remove after inlining... (load_got_register): ...here. Rework the initialization of the GOT register and of the GOT helper. (save_local_or_in_reg_p): Test the REGNO of the GOT register. (sparc_file_end): Test got_helper_needed to decide whether the GOT helper must be emitted. Use output_asm_insn instead of fprintf. (sparc_init_pic_reg): In PIC mode, always initialize the PIC register if optimization is enabled. * config/sparc/sparc.md (load_pcrel_sym<P:mode>): Emit the assembly by calling output_load_pcrel_sym. Added: trunk/gcc/testsuite/gcc.c-torture/compile/20191108-1.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/sparc/sparc-protos.h trunk/gcc/config/sparc/sparc.c trunk/gcc/config/sparc/sparc.md trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.target/sparc/overflow-3.c trunk/gcc/testsuite/gcc.target/sparc/overflow-4.c trunk/gcc/testsuite/gcc.target/sparc/overflow-5.c
Author: ebotcazou Date: Fri Nov 8 12:33:48 2019 New Revision: 277967 URL: https://gcc.gnu.org/viewcvs?rev=277967&root=gcc&view=rev Log: PR target/92095 * config/sparc/sparc-protos.h (output_load_pcrel_sym): Declare. * config/sparc/sparc.c (sparc_cannot_force_const_mem): Revert latest change. (got_helper_needed): New static variable. (output_load_pcrel_sym): New function. (get_pc_thunk_name): Remove after inlining... (load_got_register): ...here. Rework the initialization of the GOT register and of the GOT helper. (save_local_or_in_reg_p): Test the REGNO of the GOT register. (sparc_file_end): Test got_helper_needed to decide whether the GOT helper must be emitted. Use output_asm_insn instead of fprintf. (sparc_init_pic_reg): In PIC mode, always initialize the PIC register if optimization is enabled. * config/sparc/sparc.md (load_pcrel_sym<P:mode>): Emit the assembly by calling output_load_pcrel_sym. Added: branches/gcc-9-branch/gcc/testsuite/gcc.c-torture/compile/20191108-1.c - copied unchanged from r277966, trunk/gcc/testsuite/gcc.c-torture/compile/20191108-1.c Modified: branches/gcc-9-branch/gcc/ChangeLog branches/gcc-9-branch/gcc/config/sparc/sparc-protos.h branches/gcc-9-branch/gcc/config/sparc/sparc.c branches/gcc-9-branch/gcc/config/sparc/sparc.md branches/gcc-9-branch/gcc/testsuite/ChangeLog branches/gcc-9-branch/gcc/testsuite/gcc.target/sparc/overflow-3.c branches/gcc-9-branch/gcc/testsuite/gcc.target/sparc/overflow-4.c branches/gcc-9-branch/gcc/testsuite/gcc.target/sparc/overflow-5.c
Author: ebotcazou Date: Fri Nov 8 12:38:03 2019 New Revision: 277968 URL: https://gcc.gnu.org/viewcvs?rev=277968&root=gcc&view=rev Log: PR target/92095 * config/sparc/sparc-protos.h (output_load_pcrel_sym): Declare. * config/sparc/sparc.c (sparc_cannot_force_const_mem): Revert latest change. (got_helper_needed): New static variable. (output_load_pcrel_sym): New function. (get_pc_thunk_name): Remove after inlining... (load_got_register): ...here. Rework the initialization of the GOT register and of the GOT helper. (save_local_or_in_reg_p): Test the REGNO of the GOT register. (sparc_file_end): Test got_helper_needed to decide whether the GOT helper must be emitted. Use output_asm_insn instead of fprintf. (sparc_init_pic_reg): In PIC mode, always initialize the PIC register if optimization is enabled. * config/sparc/sparc.md (load_pcrel_sym<P:mode>): Emit the assembly by calling output_load_pcrel_sym. Added: branches/gcc-8-branch/gcc/testsuite/gcc.c-torture/compile/20191108-1.c - copied unchanged from r277967, trunk/gcc/testsuite/gcc.c-torture/compile/20191108-1.c Modified: branches/gcc-8-branch/gcc/ChangeLog branches/gcc-8-branch/gcc/config/sparc/sparc-protos.h branches/gcc-8-branch/gcc/config/sparc/sparc.c branches/gcc-8-branch/gcc/config/sparc/sparc.md branches/gcc-8-branch/gcc/testsuite/ChangeLog branches/gcc-8-branch/gcc/testsuite/gcc.target/sparc/overflow-3.c branches/gcc-8-branch/gcc/testsuite/gcc.target/sparc/overflow-4.c branches/gcc-8-branch/gcc/testsuite/gcc.target/sparc/overflow-5.c
This should compile again.
Hello, This patch produce a regression on sparcv8 SS10 platform. In Buildroot we have a defconfig qemu_sparc_ss10_defconfig that was working (booting) with gcc 7.4, 8.3 and 9.2. But it doesn't boot anymore with gcc 8.4, 9.3 and 10.2. I reverted this patch to be able to boot the system. See: http://patchwork.ozlabs.org/project/buildroot/patch/20210120230234.2086807-1-romain.naour@gmail.com/ Best regards, Romain
> This patch produce a regression on sparcv8 SS10 platform. > > In Buildroot we have a defconfig qemu_sparc_ss10_defconfig that was working > (booting) with gcc 7.4, 8.3 and 9.2. But it doesn't boot anymore with gcc > 8.4, 9.3 and 10.2. > > I reverted this patch to be able to boot the system. > > See: > http://patchwork.ozlabs.org/project/buildroot/patch/20210120230234.2086807-1- > romain.naour@gmail.com/ Unfortunately there is not enough information to investigate here. Please consider creating a new PR as explained on https://gcc.gnu.org/bugs