RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1788104 - internal compiler error: in final_scan_insn when building MariaDB on aarch64
Summary: internal compiler error: in final_scan_insn when building MariaDB on aarch64
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gcc
Version: 7.6
Hardware: aarch64
OS: Linux
Target Milestone: rc
: ---
Assignee: Marek Polacek
QA Contact: Alexandra Petlanová Hájková
Depends On:
Blocks: 1782203
TreeView+ depends on / blocked
Reported: 2020-01-06 12:43 UTC by vladbogolin
Modified: 2020-10-05 08:29 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-01-13 19:29:12 UTC
Target Upstream Version:

Attachments (Terms of Use)
Preprocessed source (2.08 MB, text/x-csrc)
2020-01-06 12:43 UTC, vladbogolin
no flags Details

System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 67143 0 P3 RESOLVED [5/6 Regression] ICE (could not split insn) on aarch64-linux-gnu 2020-03-24 17:34:16 UTC

Description vladbogolin 2020-01-06 12:43:00 UTC
Created attachment 1650115 [details]
Preprocessed source

Description of problem:

Compilation of MariaDB fails with the following message:

/buildbot/mariadb-10.2.31/storage/innobase/row/row0log.cc:3734:1: error: could not split insn
(insn 1149 2680 2096 (parallel [
            (set (reg:DI 1 x1 [orig:195 D.104813 ] [195])
                (mem/v:DI (reg/f:DI 20 x20 [588]) [-1  S8 A64]))
            (set (mem/v:DI (reg/f:DI 20 x20 [588]) [-1  S8 A64])
                (unspec_volatile:DI [
                        (plus:DI (mem/v:DI (reg/f:DI 20 x20 [588]) [-1  S8 A64])
                            (const_int 536870912 [0x20000000]))
                        (const_int 5 [0x5])
                    ] UNSPECV_ATOMIC_OP))
            (clobber (reg:CC 66 cc))
            (clobber (reg:DI 2 x2))
            (clobber (reg:SI 0 x0))
        ]) /buildbot/mariadb-10.2.31/include/my_atomic.h:274 1832 {atomic_fetch_adddi}
     (expr_list:REG_UNUSED (reg:CC 66 cc)
        (expr_list:REG_UNUSED (reg:DI 2 x2)
            (expr_list:REG_UNUSED (reg:SI 0 x0)
/buildbot/mariadb-10.2.31/storage/innobase/row/row0log.cc:3734:1: internal compiler error: in final_scan_insn, at final.c:2897
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/cc4FYZbl.out file, please attach this to your bugreport.

How reproducible:
This is reproducible on RHEL7 and also on CentOS-7

Comment 2 Jakub Jelinek 2020-01-07 16:05:46 UTC
I think this is upstream PR67143, except that the patch as is doesn't really work, because as can be seen in tmp-mddump.md, unlike GCC 5, GCC 4.8 didn't support using mode attributes in code attributes as the patch uses.
The "IJ" from the code attribute works fine, but instead of having there "K" or "L" (the former for QI/HI/SImode and latter for DImode for xor/ior/and, tmp-mddump.md contains unexpanded <lconst_atomic>.
The following seems to work for the above preprocessed source instead (or we could split the 3 define_insn_and_split patterns, having one for plus/minus and noather one for xor/and/ior, or
having one for QI/HI/SImode and another one for DImode.

--- gcc/config/aarch64/atomics.md.jj	2015-06-18 16:33:14.157720233 +0200
+++ gcc/config/aarch64/atomics.md	2020-01-07 16:52:29.012105743 +0100
@@ -115,16 +115,20 @@
+(define_code_attr const_atomic
+  [(plus "no,yes") (minus "no,yes")
+   (xor "yes,no") (ior "yes,no") (and "yes,no")])
 (define_insn_and_split "atomic_<atomic_optab><mode>"
-  [(set (match_operand:ALLI 0 "aarch64_sync_memory_operand" "+Q")
+  [(set (match_operand:ALLI 0 "aarch64_sync_memory_operand" "+Q,Q")
       [(atomic_op:ALLI (match_dup 0)
-	(match_operand:ALLI 1 "<atomic_op_operand>" "r<lconst_atomic>"))
+	(match_operand:ALLI 1 "<atomic_op_operand>" "r<lconst_atomic>,rIJ"))
        (match_operand:SI 2 "const_int_operand")]		;; model
        (clobber (reg:CC CC_REGNUM))
-   (clobber (match_scratch:ALLI 3 "=&r"))
-   (clobber (match_scratch:SI 4 "=&r"))]
+   (clobber (match_scratch:ALLI 3 "=&r,&r"))
+   (clobber (match_scratch:SI 4 "=&r,&r"))]
   "&& reload_completed"
@@ -134,6 +138,7 @@
 			    operands[1], operands[2], operands[4]);
+  [(set_attr "enabled" "<const_atomic>")]
 (define_insn_and_split "atomic_nand<mode>"
@@ -159,17 +164,17 @@
 (define_insn_and_split "atomic_fetch_<atomic_optab><mode>"
-  [(set (match_operand:ALLI 0 "register_operand" "=&r")
-    (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q"))
+  [(set (match_operand:ALLI 0 "register_operand" "=&r,&r")
+    (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q,Q"))
    (set (match_dup 1)
       [(atomic_op:ALLI (match_dup 1)
-	(match_operand:ALLI 2 "<atomic_op_operand>" "r<lconst_atomic>"))
+	(match_operand:ALLI 2 "<atomic_op_operand>" "r<lconst_atomic>,rIJ"))
        (match_operand:SI 3 "const_int_operand")]		;; model
    (clobber (reg:CC CC_REGNUM))
-   (clobber (match_scratch:ALLI 4 "=&r"))
-   (clobber (match_scratch:SI 5 "=&r"))]
+   (clobber (match_scratch:ALLI 4 "=&r,&r"))
+   (clobber (match_scratch:SI 5 "=&r,&r"))]
   "&& reload_completed"
@@ -179,6 +184,7 @@
 			     operands[2], operands[3], operands[5]);
+  [(set_attr "enabled" "<const_atomic>")]
 (define_insn_and_split "atomic_fetch_nand<mode>"
@@ -206,17 +212,17 @@
 (define_insn_and_split "atomic_<atomic_optab>_fetch<mode>"
-  [(set (match_operand:ALLI 0 "register_operand" "=&r")
+  [(set (match_operand:ALLI 0 "register_operand" "=&r,&r")
-      (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q")
-      (match_operand:ALLI 2 "<atomic_op_operand>" "r<lconst_atomic>")))
+      (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q,Q")
+      (match_operand:ALLI 2 "<atomic_op_operand>" "r<lconst_atomic>,rIJ")))
    (set (match_dup 1)
       [(match_dup 1) (match_dup 2)
        (match_operand:SI 3 "const_int_operand")]		;; model
     (clobber (reg:CC CC_REGNUM))
-   (clobber (match_scratch:SI 4 "=&r"))]
+   (clobber (match_scratch:SI 4 "=&r,&r"))]
   "&& reload_completed"
@@ -226,6 +232,7 @@
 			     operands[2], operands[3], operands[4]);
+  [(set_attr "enabled" "<const_atomic>")]
 (define_insn_and_split "atomic_nand_fetch<mode>"

Or we could backport whatever gen* change made the backport to work, but guess that one would require inspection of the insn* files before/after on all architectures and verify without the backport nothing changed and with the backport only the 6 expanded define_insn_and_split patterns.

Comment 3 Marek Polacek 2020-01-13 17:47:40 UTC
Let's go with Jakub's Comment 2 patch for now.  So dev_ack+ and adding onto the wishlist.

Comment 7 Marek Polacek 2020-01-13 19:29:12 UTC
Given this is an aarch64 problem only, fixing it in RHEL 7.9 would not help; the only way would be to issue a z-stream.  But that is reserved for critical issues only, and this BZ doesn't seem to meet the bar.  Thus closing.

Note You need to log in before you can comment on or make changes to this bug.