From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15821 invoked by alias); 28 Feb 2003 05:56:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 15791 invoked by uid 71); 28 Feb 2003 05:56:00 -0000 Date: Fri, 28 Feb 2003 05:56:00 -0000 Message-ID: <20030228055600.15790.qmail@sources.redhat.com> To: wilson@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Richard Henderson Subject: Re: c/7871: ICE on legal code, global register variables problems Reply-To: Richard Henderson X-SW-Source: 2003-02/txt/msg01475.txt.bz2 List-Id: The following reply was made to PR c/7871; it has been noted by GNATS. From: Richard Henderson To: Jim Wilson Cc: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, rz@linux-m68k.org, wilson@gcc.gnu.org Subject: Re: c/7871: ICE on legal code, global register variables problems Date: Thu, 27 Feb 2003 21:47:11 -0800 On Thu, Feb 27, 2003 at 10:23:53PM -0500, Jim Wilson wrote: > ! /* Calls change all call-used registers. Calls may or may not > ! change global registers. Since this will cause previous stores > ! to be deleted as dead, we must assume that global registers are > ! not set in the call. */ > for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) > ! if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i) > ! && ! global_regs[i]) I don't think this is right. The call may change the variable. If we don't mark the value set, we won't have proper log_links. The register was *supposed* to be marked used by /* Calls may also reference any of the global registers, so they are made live. */ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) if (global_regs[i]) mark_used_reg (pbi, regno_reg_rtx[i], cond, insn); so I'm not sure where we went wrong... A test case that I think may fail with your change is register int d __asm__("d7"); void bar() { if (d != 1) abort(); d = 4; } void baz() { if (d != 6) abort(); } int main() { d = 1; bar(); d |= 2; baz(); return 0; } If log_links are wrong, combine will see d=1 linked with d|=2 and produce d=3. r~