[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-patches
Subject: [tree-ssa] Another DFA fix
From: law () redhat ! com
Date: 2003-04-30 17:26:33
[Download RAW message or body]
Oh how I wish I had gotten involved in this code earlier, then I might
know why we have this tendency to ignore operands of ADDR_EXPRs....
While analyzing testsuite failures for my useless crud removal pass
I ran into this little gem.... Consider this code:
bar (d)
{
struct foo * u.1;
struct foo u;
u.d = d_1;
u.1_4 = &u_3;
return (int)u.1_4;
}
The statement u.1_4 = &u_3 has no uses or vuses because the DFA code
ignores most ADDR_EXPR expressions. That seems, well, wrong.
Anyway, since the statement in question has no operands, there uses of
u, so DCE deleted the u.d = d1 statement. Also since there were no uses
of u, the crud zapper deleted struct foo u.
This triggered an abort because, well, we'd removed the variable u,
but it still had a use in the program.
This fixes the problem, but I'd really like Diego to chime in with
the original rationale behind ignoring operands of ADDR_EXPRs so that
we can:
1. See if the rationale makes sense
2. Document whatever behavior we implement.
* tree-dfa.c (get_expr_operands): Do not ignore operands of an
an ADDR_EXPR if it is a PARM_DECL or VAR_DECL.
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.102
diff -c -3 -p -r1.1.4.102 tree-dfa.c
*** tree-dfa.c 30 Apr 2003 16:30:59 -0000 1.1.4.102
--- tree-dfa.c 30 Apr 2003 17:22:07 -0000
*************** get_expr_operands (stmt, expr_p, flags,
*** 337,343 ****
of interest. */
if (subcode != COMPONENT_REF
&& subcode != INDIRECT_REF
! && subcode != ARRAY_REF)
return;
/* Avoid recursion. */
--- 337,345 ----
of interest. */
if (subcode != COMPONENT_REF
&& subcode != INDIRECT_REF
! && subcode != ARRAY_REF
! && subcode != PARM_DECL
! && subcode != VAR_DECL)
return;
/* Avoid recursion. */
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic