This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Virtual operands of &a[1]?
Hello,
> > > > It shouldn't be. tree-simple.c contains the GIMPLE grammar. If it's
> > > > missing something, it should be fixed. The is_gimple_* predicates are
> > > > used to validate expressions.
> > >
> > > but we do not keep it in this shape. For example ccp hapily produces
> > > statements like
> > >
> > > *(&int_dest[1] + 4B) = 5
> > >
> > > whose lhs does not match the "'*' ID" pattern.
> > I've got into this problem too and it is bug in folding.
> > See http://gcc.gnu.org/ml/gcc-patches/2003-11/msg01721.html
> > Perhaps Richard will be still interested to look into it in the case you
> > do have testcase that still reproduce.
> >
> Yes, if we are still getting such expressions, we should fix them. Test
> case?
int int_dest[3];
void foo (void)
{
int *idest = int_dest;
idest++;
idest++;
*idest = 5;
}
with the following patch:
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.189
diff -c -3 -p -r1.1.4.189 tree-dfa.c
*** tree-dfa.c 27 Nov 2003 04:01:02 -0000 1.1.4.189
--- tree-dfa.c 29 Nov 2003 10:35:53 -0000
*************** get_expr_operands (tree stmt, tree *expr
*** 526,531 ****
--- 526,534 ----
|| code == TRUTH_XOR_EXPR
|| code == COMPOUND_EXPR)
{
+ if (class != 'e')
+ TREE_INVARIANT (expr) = (TREE_INVARIANT (TREE_OPERAND (expr, 0))
+ & TREE_INVARIANT (TREE_OPERAND (expr, 1)));
get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags, prev_vops);
get_expr_operands (stmt, &TREE_OPERAND (expr, 1), flags, prev_vops);
return;
Zdenek