public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Is this use of rtx_addr_varies_p an aliasing bug?
@ 2004-04-08 16:24 Nigel Stephens
  2004-04-21  3:22 ` Jim Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Nigel Stephens @ 2004-04-08 16:24 UTC (permalink / raw)
  To: gcc-bugs

I've been reviewing some patches which I'd made to gcc-2.95, for 
possible merging into 3.4 and 3.5, and I've come across a bug fix which 
still appears to apply - in fact more so in 3.x, since this idiom is now 
used more frequently.

What I see is several calls to true_dependence and canon_true_dependence 
passing a pointer to function rtx_addr_varies_p as their VARIES 
argument, for example in gcse.c:

  if (true_dependence (dest, GET_MODE (dest), gcse_mem_operand,
               rtx_addr_varies_p))
    gcse_mems_conflict_p = 1;

Walking through true_dependence, and then 
fixed_scalar_and_varying_struct_p, the expression which ultimately gets 
passed to the VARIES function is not the original MEM, but the address 
of the MEM, e.g.

  if (MEM_SCALAR_P (mem1) && MEM_IN_STRUCT_P (mem2)
      && !varies_p (mem1_addr, 1) && varies_p (mem2_addr, 1))
    /* MEM1 is a scalar at a fixed address; MEM2 is a struct at a
       varying address.  */
    return mem1;

But then looking at rtx_addr_varies_p, the only thing which can make it 
return true is if it finds a MEM whose address varies (rtx_varies_p). 
This seems to be wrong because it will never (except on some CISC 
architectures I guess) be passed the enclosing MEM. My hunch is that all 
current uses of rtx_addr_varies_p should be replaced by rtx_varies_p, 
and rtx_addr_varies_p should then be removed. Does that make sense, or 
have I missed something?

Regards

Nigel



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-21  3:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-08 16:24 Is this use of rtx_addr_varies_p an aliasing bug? Nigel Stephens
2004-04-21  3:22 ` Jim Wilson

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).