Created attachment 1815931 [details] preprocessed source Description of problem: Modulus operation with input and output being a hard register will cause a internal compiler error when building with -O and -mcpu=power9 or power10. There is already an upstream gcc12/git bug filed here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101882 We found out that this bug is also reproducing in our gcc (gcc-11.2.1-2.2.el9.ppc64le). Version-Release number of selected component (if applicable): gcc-11.2.1-2.2.el9.ppc64le How reproducible: 100% Steps to Reproduce: foofoo9.c: register a __asm__("r20"); b() { a = a % 9 ; } # does not occur with -O0, or with -mcpu=power8. $ gcc -O -mcpu=power9 foofoo9.c Actual results: foo.c: In function ‘b’: foo.c:2:23: error: unable to generate reloads for impossible constraints: 2 | b() { a = a % 9 ; } | ^ (insn 8 7 11 2 (set (reg/v:SI 20 20 [ a ]) (mod:SI (reg/v:SI 20 20 [ a ]) (reg:SI 121))) "foo.c":2:17 194 {*modsi3} (expr_list:REG_DEAD (reg:SI 121) (nil))) during RTL pass: reload foo.c:2:23: internal compiler error: in process_alt_operands, at lra-constraints.c:3108 Please submit a full bug report, with preprocessed source if appropriate. See <http://bugzilla.redhat.com/bugzilla> for instructions. Preprocessed source stored into /tmp/ccZWfCCO.out file, please attach this to your bugreport. Expected results: No internal compiler error.
I think this breaks the build of valgrind so will merit exception+ when we have a fix.
No progress upstream, moving ITM. I no longer think there will be a fix available for 9-Beta.
*** Bug 2003137 has been marked as a duplicate of this bug. ***
No progress upstream. It may not even make RHEL 9.1. Perhaps we should track the problem in the upstream PR then.