Created attachment 1780768 [details] t.cc Description of problem: # uname -a Linux hpe-apollo-cn99xx-14-vm-10.khw4.lab.eng.bos.redhat.com 4.18.0-305.1.el8.aarch64 #1 SMP Fri Apr 30 16:27:55 EDT 2021 aarch64 aarch64 aarch64 GNU/Linux # g++ --version g++ (GCC) 8.4.1 20210423 (Red Hat 8.4.1-2) # g++ -c -std=c++14 -fPIC -O2 t.cc -w t.cc: In function ‘void Quarantine<Callback>::DoRecycle() [with Callback = QuarantineCallback]’: t.cc:30:2: error: could not split insn } ^ (insn:TI 53 50 163 (parallel [ (set (reg:CC 66 cc) (unspec_volatile:CC [ (const_int 0 [0]) ] UNSPECV_ATOMIC_CMPSW)) (set (reg:DI 1 x1 [114]) (mem/v:DI (reg/f:DI 23 x23 [128]) [-1 S8 A128])) (set (mem/v:DI (reg/f:DI 23 x23 [128]) [-1 S8 A128]) (unspec_volatile:DI [ (const_int 42084505273 [0x9cc6e96b9]) (reg/v:DI 0 x0 [orig:97 xchg ] [97]) (const_int 0 [0]) (const_int 32773 [0x8005]) (const_int 32773 [0x8005]) ] UNSPECV_ATOMIC_CMPSW)) (clobber (reg:SI 2 x2 [134])) ]) "t.cc":6 3372 {aarch64_compare_and_swapdi} (expr_list:REG_DEAD (reg/v:DI 0 x0 [orig:97 xchg ] [97]) (expr_list:REG_UNUSED (reg:CC 66 cc) (expr_list:REG_UNUSED (reg:SI 2 x2 [134]) (expr_list:REG_UNUSED (reg:DI 1 x1 [114]) (nil)))))) during RTL pass: final t.cc:30:2: internal compiler error: in final_scan_insn_1, at final.c:3145 The attached test case got reduce from compiler-rt source by cvise.
Slightly more reduced testcase: // PR target/87839 // { dg-do compile { target c++11 } } // { dg-options "-O2" } // { dg-additional-options "-fpic" { target fpic } } long long a; static inline bool c(unsigned long long *j) { long long d = a, c = *j; __sync_val_compare_and_swap(&a, c, d); return true; } struct m { m(int *); }; struct p { void g() { m h(&aa); } int aa; }; struct q { using k = p; void g() { l.g(); } k l; }; template <typename> using n = q; using o = n<int>; struct t { long ab; void *ac[64]; }; struct F { t *r(); }; long x; template <typename s> struct G { F af; s u; void __attribute__((noinline)) ae() { while (t *b = af.r()) for (long j = 0; j < 6; j++) for (long i = x, e = b->ab; i < e; i++) if (i + e) u.v((int *)b->ac[i]); } }; struct H { o w; void v(int *j) { w.g(); if (j) { unsigned long long f = 12084505273LL; c(&f); } } }; struct x { G<H> ah; x(int); void y() { ah.ae(); } } g(0); void aj() { g.y(); }
This will be fixed next week by a new GCC 8.4.1 tarball.
8.5.0 tarball ;) Fixed upstream now: https://gcc.gnu.org/r8-10959-g3488242b9a949ebc55b4a857380f94506f90ff76
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Low: gcc security and bug fix update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2021:4386