diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-25 21:36:24 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-25 21:36:24 +0000 |
commit | 2f96475c32ccd16122473fdadc5ab6f1885f5351 (patch) | |
tree | 97fb8429916e88ae81fa00fe312809a322531099 /gcc/tree-cfg.c | |
parent | 881e5e0479e2e1bddc1e827a175d5aba18819134 (diff) | |
download | gcc-2f96475c32ccd16122473fdadc5ab6f1885f5351.tar.gz |
* tree-cfg.c (verify_expr, case ADDR_EXPR): Verify invariant,
constant and side_effects of the ADDR_EXPR are consistent.
* tree-nested.c (convert_local_reference): Set CURRENT_FUNCTION_DECL
appropriately around calls to recompute_tree_invarant_for_addr_expr.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100168 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 85 |
1 files changed, 60 insertions, 25 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 22215a39127..a219d8b760f 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3429,32 +3429,67 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) break; case ADDR_EXPR: - /* ??? tree-ssa-alias.c may have overlooked dead PHI nodes, missing - dead PHIs that take the address of something. But if the PHI - result is dead, the fact that it takes the address of anything - is irrelevant. Because we can not tell from here if a PHI result - is dead, we just skip this check for PHIs altogether. This means - we may be missing "valid" checks, but what can you do? - This was PR19217. */ - if (in_phi) - break; + { + bool old_invariant; + bool old_constant; + bool old_side_effects; + bool new_invariant; + bool new_constant; + bool new_side_effects; + + /* ??? tree-ssa-alias.c may have overlooked dead PHI nodes, missing + dead PHIs that take the address of something. But if the PHI + result is dead, the fact that it takes the address of anything + is irrelevant. Because we can not tell from here if a PHI result + is dead, we just skip this check for PHIs altogether. This means + we may be missing "valid" checks, but what can you do? + This was PR19217. */ + if (in_phi) + break; - /* Skip any references (they will be checked when we recurse down the - tree) and ensure that any variable used as a prefix is marked - addressable. */ - for (x = TREE_OPERAND (t, 0); - handled_component_p (x); - x = TREE_OPERAND (x, 0)) - ; - - if (TREE_CODE (x) != VAR_DECL && TREE_CODE (x) != PARM_DECL) - return NULL; - if (!TREE_ADDRESSABLE (x)) - { - error ("address taken, but ADDRESSABLE bit not set"); - return x; - } - break; + old_invariant = TREE_INVARIANT (t); + old_constant = TREE_CONSTANT (t); + old_side_effects = TREE_SIDE_EFFECTS (t); + + recompute_tree_invarant_for_addr_expr (t); + new_invariant = TREE_INVARIANT (t); + new_side_effects = TREE_SIDE_EFFECTS (t); + new_constant = TREE_CONSTANT (t); + + if (old_invariant != new_invariant) + { + error ("invariant not recomputed when ADDR_EXPR changed"); + return t; + } + + if (old_constant != new_constant) + { + error ("constant not recomputed when ADDR_EXPR changed"); + return t; + } + if (old_side_effects != new_side_effects) + { + error ("side effects not recomputed when ADDR_EXPR changed"); + return t; + } + + /* Skip any references (they will be checked when we recurse down the + tree) and ensure that any variable used as a prefix is marked + addressable. */ + for (x = TREE_OPERAND (t, 0); + handled_component_p (x); + x = TREE_OPERAND (x, 0)) + ; + + if (TREE_CODE (x) != VAR_DECL && TREE_CODE (x) != PARM_DECL) + return NULL; + if (!TREE_ADDRESSABLE (x)) + { + error ("address taken, but ADDRESSABLE bit not set"); + return x; + } + break; + } case COND_EXPR: x = COND_EXPR_COND (t); |