This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/34637] New: ICE in rws_insn_set, at config/ia64/ia64.c:5335
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Subject: [Bug target/34637] New: ICE in rws_insn_set, at config/ia64/ia64.c:5335
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following testcase ICEs on the 4.1 branch with -O2 and up and on mainline
with
-O and up.
class Atomic {
public:
static int add (int add_value, volatile int* dest);
};
inline int Atomic::add (int add_value, volatile int* dest) {
int sum = 0;
if (add_value == 1) {
__asm__ volatile ("mf;;fetchadd4.acq %0=[%1],1;;" : "=r" (sum) : "r" (dest)
: "memory");
++sum;
} else if (add_value == -1) {
__asm__ volatile ("mf;;fetchadd4.acq %0=[%1],-1;;" : "=r" (sum) : "r"
(dest) : "memory");
--sum;
} else {
int compare_value = 0;
int exchange_value = 0;
__asm__ volatile
(
" mf;;"
"0: ld4 %0=[%7];;"
" add %1=%6,%0;;"
" zxt4 %0=%0;;"
" mov ar.ccv=%0;;"
" cmpxchg4.acq %1=[%7],%1,ar.ccv;;"
" cmp4.ne p15,p0=%0,%1;"
" add %2=%6,%0;"
" (p15) br.cond.spnt 0b;;"
: "=r" (compare_value) ,
"=r" (exchange_value) ,
"=r" (sum)
: "0" (compare_value) ,
"1" (exchange_value) ,
"2" (sum) ,
"r" (add_value) ,
"r" (dest)
: "p15", "memory");
}
return sum;
};
class FooClass {
private:
static volatile int _pending_yields;
static volatile int _pending_decrements;
public:
void doit();
static void ack() {
int decrement = _pending_decrements;
if (decrement > 0) {
Atomic::add(-decrement, &_pending_decrements);
Atomic::add(-decrement, &_pending_yields);
}
}
};
void FooClass::doit() {
FooClass::ack();
}
backtrace on mainline with a cross from x86_64 is
#1 0x0000000000d70bea in rws_insn_set (regno=14)
at /space/rguenther/src/svn/trunk/gcc/config/ia64/ia64.c:5335
#2 0x0000000000d70854 in rws_access_regno (regno=14, flags=
{is_write = 1, is_fp = 0, is_branch = 0, is_and = 0, is_or = 0,
is_sibcall = 0}, pred=0) at
/space/rguenther/src/svn/trunk/gcc/config/ia64/ia64.c:5431
#3 0x0000000000d70dcf in rws_access_reg (reg=0x2b03312f7b20, flags=
{is_write = 1, is_fp = 0, is_branch = 0, is_and = 0, is_or = 0,
is_sibcall = 0}, pred=0) at
/space/rguenther/src/svn/trunk/gcc/config/ia64/ia64.c:5541
#4 0x0000000000d715e1 in rtx_needs_barrier (x=0x2b03312f7b20, flags=
{is_write = 1, is_fp = 0, is_branch = 0, is_and = 0, is_or = 0,
is_sibcall = 0}, pred=0) at
/space/rguenther/src/svn/trunk/gcc/config/ia64/ia64.c:5794
#5 0x0000000000d71534 in rtx_needs_barrier (x=0x2b0330a318e0, flags=
{is_write = 0, is_fp = 0, is_branch = 0, is_and = 0, is_or = 0,
is_sibcall = 0}, pred=0) at
/space/rguenther/src/svn/trunk/gcc/config/ia64/ia64.c:5775
#6 0x0000000000d71d3c in group_barrier_needed (insn=0x2b033094dfa0)
at /space/rguenther/src/svn/trunk/gcc/config/ia64/ia64.c:6089
#7 0x0000000000d7209c in emit_all_insn_group_barriers (dump=0x0)
at /space/rguenther/src/svn/trunk/gcc/config/ia64/ia64.c:6222
#8 0x0000000000d76da5 in ia64_reorg ()
--
Summary: ICE in rws_insn_set, at config/ia64/ia64.c:5335
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
GCC target triplet: ia64-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34637