From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2176 invoked by alias); 2 Jan 2008 09:58:53 -0000 Received: (qmail 2149 invoked by uid 22791); 2 Jan 2008 09:58:52 -0000 X-Spam-Check-By: sourceware.org Received: from server1.sourceware.org (HELO localhost.localdomain) (127.0.0.1) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 02 Jan 2008 09:53:13 +0000 Subject: [Bug target/34637] New: ICE in rws_insn_set, at config/ia64/ia64.c:5335 X-Mailer: Mail::Mailer[v1.74] Net::SMTP[v2.29] X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Date: Wed, 02 Jan 2008 09:58:00 -0000 X-SW-Source: 2008-01/txt/msg00042.txt.bz2 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