public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Diego Novillo <dnovillo@redhat.com>
To: Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
Cc: Richard Henderson <rth@redhat.com>, "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: Serious problems with tree-ssa operand handling
Date: Tue, 07 Sep 2004 14:12:00 -0000	[thread overview]
Message-ID: <1094566367.21733.25.camel@localhost.localdomain> (raw)
In-Reply-To: <10409071147.AA24235@vlsi1.ultra.nyu.edu>

On Tue, 2004-09-07 at 07:47, Richard Kenner wrote:

> As I said originally, this puts a pointer into the stack of that function
> into the operands of the statement.  That causes an access of junk when
> the operands are referenced.
> 
No, it does not.  VAR is not a GIMPLE register, follow what happens to
non-GIMPLE registers in add_stmt_operand:

   1424 add_stmt_operand (tree *var_p, tree stmt, int flags)
   1425 {
[ ... ]
   1430
   1431   var = *var_p;
   1432   STRIP_NOPS (var);
[ ... ]
   1445   is_real_op = is_gimple_reg (var);
   1446   if (!is_real_op && !DECL_P (var))
   1447     var = get_virtual_var (var);
[ ... ]
   1463
   1464   if (is_real_op)
   1465     {
   1466       /* The variable is a GIMPLE register.  Add it to real operands.  */
   1467       if (flags & opf_is_def)
   1468         append_def (var_p);
   1469       else
   1470         append_use (var_p);
   1471     }
   1472   else
   1473     {
[ ... ]
   1497                   append_v_may_def (var);
[ ... ]
   1509                   append_v_must_def (var);
   1510                 }
[ ...]
   1515                   append_v_may_def (var);
[ ... ]
   1520               append_vuse (var);
[ ... ]
   1543                 append_v_may_def (var);
   1544
[ ... ]
   1546                 append_v_may_def (VARRAY_TREE (aliases, i));
[ ... ]
   1556                 append_vuse (var);
   1557
[ ... ]
   1559                 append_vuse (VARRAY_TREE (aliases, i));
[ ... ]
   1565      }

I have elided most of the logic.  But you see that we only ever use
VAR_P if we are given a real operand (i.e., a symbol that
is_gimple_reg).  The only reason we take the address of the variable is
because for GIMPLE regs we want to store a pointer into the operand so
that we can simplify operand replacement.

We could probably split add_stmt_operand in two so that we have a
version for GIMPLE regs and a version for others.  The downside is that
some of the preparatory logic in add_stmt_operands may have to move to
the callers.


> But I shouldn't have to put in that kludge and disable both checks.
> 
No.  Both kludges are papering over the real problem and are wrong.  I
would need a test case.  Do you have a variable that is a GIMPLE reg and
at the same time belongs to an alias set or its address is taken?


Diego.

  reply	other threads:[~2004-09-07 14:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-07 11:45 Richard Kenner
2004-09-07 14:12 ` Diego Novillo [this message]
2004-09-07 15:24 Richard Kenner
2004-09-07 15:27 ` Diego Novillo
2004-09-15 18:39   ` Joe Buck
2004-09-15 18:52     ` Gabriel Dos Reis
2004-09-07 20:41 Richard Kenner
2004-09-16  3:11 Richard Kenner
2004-09-16  3:23 ` Gabriel Dos Reis
2004-09-16  5:45 ` Richard Henderson
2004-09-16 11:32 Richard Kenner
2004-09-16 12:25 ` Gabriel Dos Reis
2004-09-16 15:39 ` Robert Dewar
2004-09-16 11:54 Richard Kenner
2004-09-16 14:30 ` Daniel Berlin
2004-09-16 13:31 Richard Kenner
2004-09-16 14:48 Richard Kenner
2004-09-16 15:16 ` Richard Earnshaw
2004-09-16 23:26 ` Kai Henningsen
2004-09-17  1:27   ` Erik Trulsson
2004-09-17  1:33 Richard Kenner

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=1094566367.21733.25.camel@localhost.localdomain \
    --to=dnovillo@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=kenner@vlsi1.ultra.nyu.edu \
    --cc=rth@redhat.com \
    /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).