Bug 67143 - [5/6 Regression] ICE (could not split insn) on aarch64-linux-gnu
Summary: [5/6 Regression] ICE (could not split insn) on aarch64-linux-gnu
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 5.2.1
: P3 normal
Target Milestone: 5.3
Assignee: mwahab
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2015-08-07 08:53 UTC by Matthias Klose
Modified: 2015-09-30 03:02 UTC (History)
1 user (show)

See Also:
Host:
Target: aarch64-linux-gnu
Build:
Known to work: 4.9.3
Known to fail: 5.2.1, 6.0
Last reconfirmed: 2015-08-20 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2015-08-07 08:53:51 UTC
seen when building mysql trunk using trunk r226068, and gcc-5-branch r226354:

$ cat btr0btr.ii
long a, c;
bool b;
int d;
void ut_dbg_assertion_failed() __attribute__((noreturn));
long dict_index_is_spatial(int *);
void btr_block_get_func(char *);
long btr_page_get_level_low(unsigned char *);
void btr_validate_level(long p1, bool) {
  unsigned char *e;
  while (p1 != btr_page_get_level_low(e)) {
    if (__builtin_expect(b, 0))
      ut_dbg_assertion_failed();
    if (dict_index_is_spatial(&d))
      while (c != 5535) {
        __sync_add_and_fetch(&a, 536870912);
        btr_block_get_func("");
      }
  }
  for (long i; i; ++i)
    btr_validate_level(-i, true);
}

$ g++ -Wno-write-strings -c -g -O3 btr0btr.ii 
btr0btr.ii: In function 'void btr_validate_level(long int, bool)':
btr0btr.ii:21:1: error: could not split insn
 }
 ^
(insn 300 298 303 (parallel [
            (set (mem/v:DI (reg/f:DI 0 x0 [234]) [-1  S8 A64])
                (unspec_volatile:DI [
                        (plus:DI (mem/v:DI (reg/f:DI 0 x0 [234]) [-1  S8 A64])
                            (const_int 536870912 [0x20000000]))
                        (const_int 5 [0x5])
                    ] UNSPECV_ATOMIC_OP))
            (clobber (reg:CC 66 cc))
            (clobber (reg:DI 1 x1 [490]))
            (clobber (reg:SI 2 x2 [491]))
        ]) btr0btr.ii:15 2451 {atomic_adddi}
     (expr_list:REG_DEAD (reg/f:DI 0 x0 [234])
        (expr_list:REG_UNUSED (reg:CC 66 cc)
            (expr_list:REG_UNUSED (reg:SI 2 x2 [491])
                (expr_list:REG_UNUSED (reg:DI 1 x1 [490])
                    (nil))))))
btr0btr.ii:21:1: internal compiler error: in final_scan_insn, at final.c:3020
0x9eadbf _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
        ../../src/gcc/rtl-error.c:110
0x80dfc7 final_scan_insn(rtx_insn*, _IO_FILE*, int, int, int*)
        ../../src/gcc/final.c:3020
0x80e287 final(rtx_insn*, _IO_FILE*, int)
        ../../src/gcc/final.c:2089
0x80e78f rest_of_handle_final
        ../../src/gcc/final.c:4488
0x80e78f execute
        ../../src/gcc/final.c:4563
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
Comment 1 ktkachov 2015-08-07 11:54:10 UTC
Seems related to something Matthew has been working on recently?
Comment 2 mwahab 2015-08-07 12:02:13 UTC
(In reply to ktkachov from comment #1)
> Seems related to something Matthew has been working on recently?

No, it looks like something to do with the <lconst_atomic> constratint introduced by https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=217076
Comment 3 mwahab 2015-08-14 15:06:14 UTC
Author: mwahab
Date: Fri Aug 14 15:05:42 2015
New Revision: 226895

URL: https://gcc.gnu.org/viewcvs?rev=226895&root=gcc&view=rev
Log:
gcc/
2015-08-14  Matthew Wahab  <matthew.wahab@arm.com>

	PR target/67143
	* config/aarch64/atomics.md (atomic_<optab><mode>): Replace
	'lconst_atomic' with 'const_atomic'.
	(atomic_fetch_<optab><mode>): Likewise.
	(atomic_<optab>_fetch<mode>): Likewise.
	* config/aarch64/iterators.md (lconst-atomic): Move below
	'const_atomic'.
	(const_atomic): New.

gcc/testsuite/
2015-08-14  Matthew Wahab  <matthew.wahab@arm.com>
	    Matthias Klose  <doko@debian.org>

	PR target/67143
	* gcc.c-torture/compile/pr67143.c: New
	* gcc.target/aarch64/atomic-op-imm.c
	(atomic_fetch_add_negative_RELAXED): New.
	(atomic_fetch_sub_negative_ACQUIRE): New.


Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr67143.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/aarch64/atomics.md
    trunk/gcc/config/aarch64/iterators.md
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.target/aarch64/atomic-op-imm.c
Comment 4 Andrew Pinski 2015-08-20 07:09:23 UTC
Confirmed.
Comment 5 mwahab 2015-09-23 09:48:48 UTC
Author: mwahab
Date: Wed Sep 23 09:48:16 2015
New Revision: 228037

URL: https://gcc.gnu.org/viewcvs?rev=228037&root=gcc&view=rev
Log:
[Aarch64][target/PR 67143][5.2] Backport correct constraints for atomic
operations.

gcc/
2015-09-23  Matthew Wahab  <matthew.wahab@arm.com>

	Backport from mainline
	2015-08-14  Matthew Wahab  <matthew.wahab@arm.com>

	PR target/67143
	* config/aarch64/atomics.md (atomic_<optab><mode>): Replace
	'lconst_atomic' with 'const_atomic'.
	(atomic_fetch_<optab><mode>): Likewise.
	(atomic_<optab>_fetch<mode>): Likewise.
	* config/aarch64/iterators.md (lconst-atomic): Move below
	'const_atomic'.
	(const_atomic): New.

gcc/testsuite/
2015-09-23  Matthew Wahab  <matthew.wahab@arm.com>

	Backport from mainline
	2015-08-14  Matthew Wahab  <matthew.wahab@arm.com>
		    Matthias Klose  <doko@debian.org>

	PR target/67143
	* gcc.c-torture/compile/pr67143.c: New
	* gcc.target/aarch64/atomic-op-imm.c
	(atomic_fetch_add_negative_RELAXED): New.
	(atomic_fetch_sub_negative_ACQUIRE): New.


Added:
    branches/gcc-5-branch/gcc/testsuite/gcc.c-torture/compile/pr67143.c
Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/config/aarch64/atomics.md
    branches/gcc-5-branch/gcc/config/aarch64/iterators.md
    branches/gcc-5-branch/gcc/testsuite/ChangeLog
    branches/gcc-5-branch/gcc/testsuite/gcc.target/aarch64/atomic-op-imm.c
Comment 6 Ramana Radhakrishnan 2015-09-30 03:02:26 UTC
Fixed then.