public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Richard Zidlicky <rz@linux-m68k.org>
To: wilson@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: c/7871: ICE on legal code, global register variables problems
Date: Wed, 02 Apr 2003 20:56:00 -0000	[thread overview]
Message-ID: <20030402205601.6322.qmail@sources.redhat.com> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3556 bytes --]

The following reply was made to PR c/7871; it has been noted by GNATS.

From: Richard Zidlicky <rz@linux-m68k.org>
To: Jim Wilson <wilson@tuliptree.org>
Cc: Richard Henderson <rth@redhat.com>, gcc-gnats@gcc.gnu.org,
	gcc-bugs@gcc.gnu.org, wilson@gcc.gnu.org
Subject: Re: c/7871: ICE on legal code, global register variables problems
Date: Wed, 2 Apr 2003 22:49:26 +0200

 On Mon, Mar 10, 2003 at 12:16:23AM -0500, Jim Wilson wrote:
 > Let me recap a bit.  The current code calls mark_set_1 (...CLOBBER...)
 > and mark_used_regs.  This causes CALL_INSNs to get a REG_UNDEAD note for
 > a global_reg, which confuses combine into deleting the insn that
 > initializes the global_reg.
 > 
 > If I change this to mark_set_1 (...SET...), then there are no
 > REG_DEAD/REG_UNUSED notes which is correct.  However, there are
 > LOG_LINKS from the insn that sets the global_reg to the CALL_INSN, and
 > from the CALL_INSN to the insn that uses the global_reg.  This causes
 > combine to merge the 3 instructions together, and the result is that the
 > first insn that sets the global_reg gets simplified away.  This could
 > perhaps be fixed by modifying combine to know that calls and global_regs
 > are special.
 > 
 > If I avoid calling mark_set_1, then there are no REG_DEAD/REG_UNUSED
 > notes, but there is still a LOG_LINK from the first insn that sets the
 > global_reg to the CALL_INSN.  When combine merges an unrelated insn into
 > the CALL_INSN, it sees a LOG_LINK that doesn't appear to belong on the
 > CALL_INSN, so it moves it to the next insn which uses the global_reg. 
 > Combine then merges two instructions that set/use the global_reg, and
 > the first global_reg set before the call disappears again.
 > 
 > Thus it seems that in order to get the right behavior, we need to avoid
 > adding any REG_NOTES or LOG_LINKS for global_regs.
 
 how does this differ from ´normal´ global variables?
 
 > I had to go back to gcc-2.95.1 to find a compiler that worked for my two
 > testcases, and it has this behavior.
 
 interesting, gcc-3.0.3 worked fine with my application. With Richard
 Henderson´s testcase 3.0.3 produces an ICE
 
 x5.c: In function `main':
 x5.c:20: Internal compiler error in verify_wide_reg_1, at flow.c:2769
 
 It works with ´-O3´ though.
  
 > I am off on a trip, so it will be a while before I am able to continue
 > working on this.
 
 fine, I have just returned after a longer trip myself.
 
 
 > 2003-03-10  James E Wilson  <wilson@tuliptree.org>
 > 
 > 	* flow.c (mark_set_1): Handle global_regs like the frame pointer.
 > 
 > Index: flow.c
 > ===================================================================
 > RCS file: /cvs/gcc/gcc/gcc/flow.c,v
 > retrieving revision 1.549
 > diff -p -r1.549 flow.c
 > *** flow.c	28 Feb 2003 10:11:47 -0000	1.549
 > --- flow.c	10 Mar 2003 05:05:08 -0000
 > *************** mark_set_1 (pbi, code, reg, cond, insn, 
 > *** 2709,2714 ****
 > --- 2709,2715 ----
 >   #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
 >         && ! (regno_first == ARG_POINTER_REGNUM && fixed_regs[regno_first])
 >   #endif
 > +       && ! (regno_first < FIRST_PSEUDO_REGISTER && global_regs[regno_first])
 >         )
 >       {
 >         int some_was_live = 0, some_was_dead = 0;
 
 my application is still miscompiled with this patch. Double checked by
 replacing it with my patch and it works again. Tested only gcc-3.2, should
 this make any difference?
 I can try to identify the piece of code that was micompiled if it helps
 but it will likely be a big unreadable ´*.i´ file.
 
 Richard


             reply	other threads:[~2003-04-02 20:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-02 20:56 Richard Zidlicky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-05-02 14:16 Richard Zidlicky
2003-05-02 12:26 Richard Zidlicky
2003-05-01  6:06 Jim Wilson
2003-04-06 19:46 Jim Wilson
2003-03-10  5:16 Jim Wilson
2003-02-28 16:46 Jim Wilson
2003-02-28  5:56 Richard Henderson
2003-02-28  3:26 Jim Wilson
2003-02-28  3:02 wilson
2002-12-14 12:56 Richard Zidlicky
2002-09-09 14:36 Richard Zidlicky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030402205601.6322.qmail@sources.redhat.com \
    --to=rz@linux-m68k.org \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=wilson@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).