This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Serious problems with tree-ssa operand handling
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: dnovillo at redhat dot com, rth at redhat dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 7 Sep 04 07:47:53 EDT
- Subject: Serious problems with tree-ssa operand handling
I sent http://gcc.gnu.org/ml/gcc/2004-09/msg00189.html on Saturday because
the breakage also happened on Friday. I've done more work here, which has left
me more confused. See also http://gcc.gnu.org/ml/gcc/2004-09/msg00196.html
The issue is the adding of virtual operands for a call. It uses alias
information to do that and adds the operand with:
tree var = referenced_var (i);
add_stmt_operand (&var, ...);
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.
I tried fixing that with:
tree *var_p = &referenced_var (i);
add_stmt_operand (var_p, stmt, opf_is_def);
That now references defined memory. But it has the problem that we then
try to put an SSA_NAME into referenced_vars, which is wrong.
Moreover, we get a verification error:
g-exctra.adb: In function `GNAT.EXCEPTION_TRACES.DECORATOR_WRAPPER':
g-exctra.adb:69: error: Found a virtual definition for a GIMPLE register
while verifying SSA_NAME decorator_traceback_35 in statement
# gnat__exception_traces__current_decorator<D449>_29 = V_MAY_DEF <gnat__except
ion_traces__current_decorator<D449>_18>;
# T.9<D466>_34 = V_MAY_DEF <T.9<D466>_23>;
# decorator_traceback<D456>_35 = V_MAY_DEF <decorator_traceback<D456>_17>;
# T.11<D468>_30 = V_MAY_DEF <T.11<D468>_28>;
# VUSE <T.8<D465>_27>;
T.11<D468> = gnat__exception_traces__current_decorator.7_19 (T.8<D465>);
This is confusing because an example in doc/tree-ssa.texi implies this sort
of thing is valid.
I disabled that check and "fixed" the clobbering of referenced_vars by trying
tree *var_p = (tree *) ggc_alloc (sizeof (tree *));
*var_p = referenced_var (i);
add_stmt_operand (var_p, stmt, opf_is_def);
Now I get another check failure, saying that a variable appears both as a
real and virtual operand. When I disable *that* check, I finally get
the Ada RTS to compile, but I get new ACATS failures (possibly related, but
maybe not).
But I shouldn't have to put in that kludge and disable both checks.
Something looks very badly wrong here but I don't understand how this is
supposed to work, so can't say what.