Bug 1995933

Summary: modulus with input and output set to a hard register
Product: Red Hat Enterprise Linux 9 Reporter: Jesus Checa <jchecahi>
Component: gccAssignee: Marek Polacek <mpolacek>
gcc sub component: system-version QA Contact: Václav Kadlčík <vkadlcik>
Status: CLOSED UPSTREAM Docs Contact:
Severity: unspecified    
Priority: unspecified CC: ahajkova, fweimer, ganandan, jakub, mnewsome, mpolacek, ohudlick, pgm-rhel-tools, pvlasin, vkadlcik
Version: 9.0Keywords: Bugfix, Triaged
Target Milestone: beta   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 2003137 (view as bug list) Environment:
Last Closed: 2022-03-07 18:59:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2003137    
Attachments:
Description Flags
preprocessed source none

Description Jesus Checa 2021-08-20 08:24:25 UTC
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.

Comment 1 Marek Polacek 2021-08-20 19:08:27 UTC
I think this breaks the build of valgrind so will merit exception+ when we have a fix.

Comment 7 Marek Polacek 2021-09-15 17:04:51 UTC
No progress upstream, moving ITM.  I no longer think there will be a fix available for 9-Beta.

Comment 10 Marek Polacek 2021-09-27 17:05:50 UTC
*** Bug 2003137 has been marked as a duplicate of this bug. ***

Comment 14 Marek Polacek 2022-03-07 18:59:22 UTC
No progress upstream.  It may not even make RHEL 9.1.  Perhaps we should track the problem in the upstream PR then.