summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr19633.c
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-01 20:30:07 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-01 20:30:07 +0000
commit1e1a4c8c01aaeaeab9ebfb0dcf901542f968339c (patch)
tree87292513a1b836b5850299e91904214e71fb9556 /gcc/testsuite/gcc.dg/pr19633.c
parent06c1e1603fb0591f620322f6205c60ea8112282e (diff)
downloadgcc-1e1a4c8c01aaeaeab9ebfb0dcf901542f968339c.tar.gz
PR tree-optimization/19633
* tree-flow.h (struct ptr_info_def): Add field 'pt_null'. * tree-ssa-alias.c (init_alias_info): Initialize. (merge_pointed_to_info): Set. (add_pointed_to_expr): Set pt_null if EXPR is a NULL pointer. (dump_points_to_info_for): Show value of pt_null. (struct count_ptr_d): Declare. (find_ptr_dereference): Remove. (ptr_is_dereferenced_by): Remove. (count_ptr_derefs): New local function. (count_uses_and_derefs): New local function. (compute_points_to_and_addr_escape): Call it. If the number of dereferences is greater than zero, mark the pointer as dereferenced. If there are fewer dereferences than uses of the pointer, the pointer's value escapes. testsuite/ChangeLog PR tree-optimization/19633 * testsuite/gcc.dg/pr19633-1.c: New test. * testsuite/gcc.dg/pr19633.c: Tweak to make pointer point to NULL or a symbol. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94558 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr19633.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr19633.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/pr19633.c b/gcc/testsuite/gcc.dg/pr19633.c
index 4e18375656f..fda0df6c5fa 100644
--- a/gcc/testsuite/gcc.dg/pr19633.c
+++ b/gcc/testsuite/gcc.dg/pr19633.c
@@ -15,12 +15,21 @@ struct T
void
foo (int a, struct T b)
{
- struct S x;
- struct S *c = &x;
+ struct S *c = 0;
+
if (a)
c = &b.s;
+
b.s.w = 3;
+
+ /* Since 'c' may be pointing to NULL here, we used to flag it as
+ pointing anywhere, which was forcing the aliaser to mark as
+ call-clobbered every other variable pointed-to by 'c' ('b' in
+ this case). This, in turn, caused the insertion of V_MAY_DEFs
+ for 'b' at this call-site, which prevented constant propagation
+ from 'b.s.w = 3' to 'if (b.s.w != 3)'. */
bar (*c, a);
+
if (b.s.w != 3)
link_error ();
}