[Bug 1353729] Re: [4.9 Regression] ICE in final_scan_insn, at final.c:2952 (aarch64-linux-gnu)

Bug Watch Updater 1353729 at bugs.launchpad.net
Wed Sep 3 17:02:47 UTC 2014


Launchpad has imported 4 comments from the remote bug at
https://bugs.linaro.org/show_bug.cgi?id=331.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2014-08-06T23:02:47+00:00 Matthias Klose wrote:

Created attachment 92
preprocessed source

seen with 4.9 linaro 2014.07, works with -O1

$ g++ -c -O2 -fPIE pfs_host.ii
/home/doko/tmp/mysql-5.6-5.6.19/storage/perfschema/pfs_host.cc: In function 'PFS_host* find_or_create_host(PFS_thread*, const char*, uint)':
/home/doko/tmp/mysql-5.6-5.6.19/storage/perfschema/pfs_host.cc:289:1: error: could not split insn
 }
 ^
(insn:TI 304 300 305 (parallel [
            (set (reg:SI 2 x2 [orig:153 D.16667 ] [153])
                (mem/v:SI (reg/f:DI 1 x1 [orig:113 D.16671 ] [113]) [-1  S4 A32]))
            (set (mem/v:SI (reg/f:DI 1 x1 [orig:113 D.16671 ] [113]) [-1  S4 A32])
                (unspec_volatile:SI [
                        (ior:SI (mem/v:SI (reg/f:DI 1 x1 [orig:113 D.16671 ] [113]) [-1  S4 A32])
                            (const_int 0 [0]))
                        (const_int 5 [0x5])
                    ] UNSPECV_ATOMIC_OP))
            (clobber (reg:CC 66 cc))
            (clobber (reg:SI 3 x3 [330]))
            (clobber (reg:SI 4 x4 [331]))
        ]) /home/doko/tmp/mysql-5.6-5.6.19/include/my_atomic.h:217 2338 {atomic_fetch_orsi}
     (expr_list:REG_UNUSED (reg:CC 66 cc)
        (expr_list:REG_UNUSED (reg:SI 4 x4 [331])
            (expr_list:REG_UNUSED (reg:SI 3 x3 [330])
                (nil)))))
/home/doko/tmp/mysql-5.6-5.6.19/storage/perfschema/pfs_host.cc:289:1: internal compiler error: in final_scan_insn, at final.c:2952
Please submit a full bug report,
with preprocessed source if appropriate.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.9/+bug/1353729/comments/0

------------------------------------------------------------------------
On 2014-08-21T17:16:47+00:00 Palachev-ilya wrote:

Created attachment 104
Reduced preprocessed source code from the example above

The mentioned testcase can be reduced to 47 lines of code.
I cannot reduce anymore.

The error is similiar, but is somehow different from yours:

pfs_host.ii:47:1: error: could not split insn
 }
 ^
(insn:TI 71 72 73 (parallel [
            (set (mem/v:SI (reg/f:DI 19 x19 [117]) [-1  S4 A32])
                (unspec_volatile:SI [
                        (ior:SI (mem/v:SI (reg/f:DI 19 x19 [117]) [-1  S4 A32])
                            (const_int 0 [0]))
                        (const_int 5 [0x5])
                    ] UNSPECV_ATOMIC_OP))
            (clobber (reg:CC 66 cc))
            (clobber (reg:SI 1 x1 [143]))
            (clobber (reg:SI 2 x2 [144]))
        ]) pfs_host.ii:32 2326 {atomic_orsi}
     (expr_list:REG_DEAD (reg/f:DI 19 x19 [117])
        (expr_list:REG_UNUSED (reg:CC 66 cc)
            (expr_list:REG_UNUSED (reg:SI 2 x2 [144])
                (expr_list:REG_UNUSED (reg:SI 1 x1 [143])
                    (nil))))))
pfs_host.ii:47:1: internal compiler error: in final_scan_insn, at final.c:2957
0xb2b8c5 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
	/home/ilya/cbuild2/build/snapshots/gcc.git/gcc/rtl-error.c:109
0x9030b1 final_scan_insn(rtx_def*, _IO_FILE*, int, int, int*)
	/home/ilya/cbuild2/build/snapshots/gcc.git/gcc/final.c:2957
0x903352 final(rtx_def*, _IO_FILE*, int)
	/home/ilya/cbuild2/build/snapshots/gcc.git/gcc/final.c:2027
0x903b52 rest_of_handle_final
	/home/ilya/cbuild2/build/snapshots/gcc.git/gcc/final.c:4453
0x903b52 execute
	/home/ilya/cbuild2/build/snapshots/gcc.git/gcc/final.c:4528
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.launchpad.net/gcc-linaro> for instructions.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.9/+bug/1353729/comments/2

------------------------------------------------------------------------
On 2014-08-21T17:19:36+00:00 Palachev-ilya wrote:

The compiler fails after function split_insns (generaged from md) fails
with the following arguments:

pattern =

(parallel [
        (set (mem/v:SI (reg/f:DI 19 x19 [117]) [-1  S4 A32])
            (unspec_volatile:SI [
                    (ior:SI (mem/v:SI (reg/f:DI 19 x19 [117]) [-1  S4 A32])
                        (const_int 0 [0]))
                    (const_int 5 [0x5])
                ] UNSPECV_ATOMIC_OP))
        (clobber (reg:CC 66 cc))
        (clobber (reg:SI 1 x1 [143]))
        (clobber (reg:SI 2 x2 [144]))
    ])

insn =

(insn:TI 71 72 73 (parallel [
            (set (mem/v:SI (reg/f:DI 19 x19 [117]) [-1  S4 A32])
                (unspec_volatile:SI [
                        (ior:SI (mem/v:SI (reg/f:DI 19 x19 [117]) [-1  S4 A32])
                            (const_int 0 [0]))
                        (const_int 5 [0x5])
                    ] UNSPECV_ATOMIC_OP))
            (clobber (reg:CC 66 cc))
            (clobber (reg:SI 1 x1 [143]))
            (clobber (reg:SI 2 x2 [144]))
        ]) pfs_host.ii:32 2326 {atomic_orsi}
     (expr_list:REG_DEAD (reg/f:DI 19 x19 [117])
        (expr_list:REG_UNUSED (reg:CC 66 cc)
            (expr_list:REG_UNUSED (reg:SI 2 x2 [144])
                (expr_list:REG_UNUSED (reg:SI 1 x1 [143])
                    (nil))))))

(from gdb output of debug_rtx(pat) and debug_rtx(insn))

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.9/+bug/1353729/comments/3

------------------------------------------------------------------------
On 2014-08-22T16:51:25+00:00 Palachev-ilya wrote:

Created attachment 110
The patch that fixes error (maybe incorrect!)

The error is related with legacy built-in functions for atomic memory access
https://gcc.gnu.org/onlinedocs/gcc-4.9.1/gcc/_005f_005fsync-Builtins.html#_005f_005fsync-Builtins

Such builtins are expanded to atomic_* instructions at expand pass.

It has been found that usually all atomic_* RTL instructions (except atomic_store*) are splitted out after pass split2 (you can check it by compiling sync-1.c from gcc testuite). So there must not be any atomic_* after split2 (except atomic_store*).
But in our case insn atomic_orsi was not splitted out after split2 and stayed in code till to the final pass.

Final pass also tries to split all instrutions, but it fails with
assertion, if at least 1 insn can not be splitted.

So the first erroneous behavior appears at least at split2 pass.

It checks the operand of atomic_orsi, using function
aarch64_logical_operand return false for 0.

In the attached patch i tried to allow aarch64_logical_operand  to work
with 0 case.

Is it correct?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.9/+bug/1353729/comments/4


** Changed in: linaro
       Status: Unknown => New

** Changed in: linaro
   Importance: Unknown => Wishlist

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-4.9 in Ubuntu.
https://bugs.launchpad.net/bugs/1353729

Title:
  [4.9 Regression] ICE in final_scan_insn, at final.c:2952 (aarch64
  -linux-gnu)

Status in Linaro:
  New
Status in “gcc-4.9” package in Ubuntu:
  Confirmed

Bug description:
  https://bugs.linaro.org/show_bug.cgi?id=331

  seen with 4.9 linaro 2014.07, works with -O1

  $ g++ -c -O2 -fPIE pfs_host.ii
  /home/doko/tmp/mysql-5.6-5.6.19/storage/perfschema/pfs_host.cc: In function 'PFS_host* find_or_create_host(PFS_thread*, const char*, uint)':
  /home/doko/tmp/mysql-5.6-5.6.19/storage/perfschema/pfs_host.cc:289:1: error: could not split insn
   }
   ^
  (insn:TI 304 300 305 (parallel [
              (set (reg:SI 2 x2 [orig:153 D.16667 ] [153])
                  (mem/v:SI (reg/f:DI 1 x1 [orig:113 D.16671 ] [113]) [-1  S4 A32]))
              (set (mem/v:SI (reg/f:DI 1 x1 [orig:113 D.16671 ] [113]) [-1  S4 A32])
                  (unspec_volatile:SI [
                          (ior:SI (mem/v:SI (reg/f:DI 1 x1 [orig:113 D.16671 ] [113]) [-1  S4 A32])
                              (const_int 0 [0]))
                          (const_int 5 [0x5])
                      ] UNSPECV_ATOMIC_OP))
              (clobber (reg:CC 66 cc))
              (clobber (reg:SI 3 x3 [330]))
              (clobber (reg:SI 4 x4 [331]))
          ]) /home/doko/tmp/mysql-5.6-5.6.19/include/my_atomic.h:217 2338 {atomic_fetch_orsi}
       (expr_list:REG_UNUSED (reg:CC 66 cc)
          (expr_list:REG_UNUSED (reg:SI 4 x4 [331])
              (expr_list:REG_UNUSED (reg:SI 3 x3 [330])
                  (nil)))))
  /home/doko/tmp/mysql-5.6-5.6.19/storage/perfschema/pfs_host.cc:289:1: internal compiler error: in final_scan_insn, at final.c:2952
  Please submit a full bug report,
  with preprocessed source if appropriate.

To manage notifications about this bug go to:
https://bugs.launchpad.net/linaro/+bug/1353729/+subscriptions



More information about the foundations-bugs mailing list