https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108268
Bug ID: 108268 Summary: [13 Regression] Build failure on cross from powerpc64le-linux to nvptx-none Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- ../configure --disable-bootstrap --disable-sjlj-exceptions --enable-newlib-io-long-long --with-build-time-tools=/builddir/build/BUILD/gcc-13.0.0-20230102/obji/usr/nvptx-none/bin -- target nvptx-none --enable-as-accelerator-for=ppc64le-redhat-linux --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl= http://bugzilla.redhat.com/bugzilla --enable-checking=release --with-system-zlib --with-gcc-major-version-only --without-isl configured GCC ICEs on compilation of all C/C++ files. The problem is that c_cpp_builtins function has &c_global_trees[0] value stored in $r30 register, but when it calls 1525 int value = dwarf_reg_sizes_constant (); the $r30 value is saved into stack frame and partially overwritten by buffer overflow. Before it is 0x0000000011939cb0 and after returning from that function 0x11930008. This is because DWARF_FRAME_RETURN_COLUMN macro defaults to DWARF_FRAME_REGISTERS, nvptx.h doesn't override it (it is a target without register allocation nor debug info), dwarf_reg_sizes_constant allocates 343 poly_uint16 *sizes = XALLOCAVEC (poly_uint16, DWARF_FRAME_REGISTERS); and then generate_dwarf_reg_sizes stores: 326 if (!init_state.wrote_return_column) 327 sizes[DWARF_FRAME_RETURN_COLUMN] = GET_MODE_SIZE (Pmode);