https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113689
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Rainer Orth from comment #7) > This patch broke Solaris/x86 (i386-pc-solaris2.11) bootstrap: > > /vol/gcc/src/hg/master/local/gcc/config/i386/i386.cc: In function 'void > x86_function_profiler(std::FILE*, int)': > /vol/gcc/src/hg/master/local/gcc/config/i386/i386.cc:22838:40: error: array > subscript -1 is below array bounds of 'const char* const [92]' > [-Werror=array-bounds=] > 22838 | reg = hi_reg_name[scratch]; > | ~~~~~~~~~~~~~~~~~~~^c-include=/vol/gcc/include > /vol/gcc/src/hg/master/local/gcc/config/i386/i386.cc:138:26: note: while > referencing 'hi_reg_name' > --with-target-bdw-gc-lib=/vol/gcc/lib,amd64=/vo 138 | static const char > *const hi_reg_name[] = HI_REGISTER_NAMES; > | ^~~~~~~~~~~ Guess for the case where we issue sorry we shouldn't return INVALID_REGNUM, but R10_REG or any other, we acknowledged we aren't emitting correct assembly already. And, as I wrote earlier, I think if we did similar discovery at pro_and_epilogue time and find we otherwise wouldn't have any registers for it and would sorry at final time, it might be better to just pick some call used register and forcibly save it even when it isn't strictly needed. Then it wouldn't sorry at final time anymore.