This is the mail archive of the
mailing list for the GCC project.
Re: Urgent: bug fixes needed for GCC 3.0.2
- To: Mark Mitchell <mark at codesourcery dot com>
- Subject: Re: Urgent: bug fixes needed for GCC 3.0.2
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Thu, 4 Oct 2001 18:21:22 +0200
- Cc: "law at redhat dot com" <law at redhat dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, "wilson at redhat dot com" <wilson at redhat dot com>, "jh at suse dot cz" <jh at suse dot cz>
- References: <email@example.com> <firstname.lastname@example.org>
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
On Thu, Oct 04, 2001 at 08:57:13AM -0700, Mark Mitchell wrote:
> > > I'm not sure. This is a MEM on the stack, and one that is not
> > > necessarily going to be around for the entire function -- witness
> > > the fact that we are going to overwrite it. Perhaps I misunderstand
> > > a subtlety of RTX_UNCHANGING_P (quite likely, in fact!) but to me
> > > it doesn't make sense to set it for this MEM; the value there is
> > > likely to change.
> > >
> > > Am I speaking nonsense?
> > Well, if it wasn't for the sibcall optimization the stack slot would be
> > unchanging. That's the crux of the issue.
This looks to me like ressurected
thread which was exactly about this.
I'm using following patch for this in gcc-2.96-RH (which Richard Kenner did
not like but it certainly is less invasive change then ignoring
RTX_UNCHANGING_P with sibling call optimization). IMHO clearing
RTX_UNCHANGING_P is a safe thing to do even if it cleared some innocent
variable's (which would be sharing the same stack slot) RTX_UNCHANGING_P
flag as opposed to setting it.
2001-03-16 Jakub Jelinek <email@example.com>
* expr.c (expand_expr): If TARGET_EXPR is putting a non-constant
variable into place of constant variable, clear the /u flag if
--- gcc/expr.c.jj Mon Mar 12 13:41:38 2001
+++ gcc/expr.c Fri Mar 16 19:46:26 2001
@@ -8167,6 +8167,17 @@ expand_expr (exp, target, tmode, modifie
DECL_RTL (slot) = target;
+ /* If target is unchanging, but slot is not, we could end up
+ initializing the unchanging target through non-unchanging
+ references. */
+ if (RTX_UNCHANGING_P (target) && ! TREE_READONLY (slot)
+ && (GET_CODE (target) == REG
+ || (GET_CODE (target) == MEM
+ && GET_CODE (XEXP (target, 0)) == ADDRESSOF
+ && GET_CODE (XEXP (XEXP (target, 0), 0)) == REG)))
+ RTX_UNCHANGING_P (target) = 0;
/* If we must have an addressable slot, then make sure that
the RTL that we just stored in slot is OK. */
if (TREE_ADDRESSABLE (slot))