diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2004-12-21 21:20:02 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2004-12-21 13:20:02 -0800 |
commit | af76441ffa6ffdfb4a4d3b10482e0d8d7e99181e (patch) | |
tree | 26a2279877aa52f21fba4ae120751143f5815a44 /gcc | |
parent | 697290b71d18569ef60fe446a689e74270457ab4 (diff) | |
download | gcc-af76441ffa6ffdfb4a4d3b10482e0d8d7e99181e.zip gcc-af76441ffa6ffdfb4a4d3b10482e0d8d7e99181e.tar.gz gcc-af76441ffa6ffdfb4a4d3b10482e0d8d7e99181e.tar.bz2 |
re PR c++/18984 (ICE in check_pointer_types_r)
2004-12-21 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/18984
* pointer-set.c (pointer_set_contains): Add back.
* pointer-set.h (pointer_set_contains): Add back.
2004-12-21 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/18984
* cp-gimplify.c (cp_genericize_r): Don't insert first but instead
check to see if contains the pointer. Insert the statement before
returning.
2004-12-21 Andrew Pinski <pinskia@physics.uc.edu>
PR C++/18984
* g++.dg/eh/ctor3.C: New test.
From-SVN: r92470
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/cp-gimplify.c | 17 | ||||
-rw-r--r-- | gcc/pointer-set.c | 23 | ||||
-rw-r--r-- | gcc/pointer-set.h | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/eh/ctor3.C | 18 |
7 files changed, 68 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b9fbcfb..52682ea 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-12-21 Andrew Pinski <pinskia@physics.uc.edu> + + PR c++/18984 + * pointer-set.c (pointer_set_contains): Add back. + * pointer-set.h (pointer_set_contains): Add back. + 2004-12-21 Richard Henderson <rth@redhat.com> * gimplify.c (eval_save_expr): New. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b0c25a7..b216480 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2004-12-21 Andrew Pinski <pinskia@physics.uc.edu> + + PR c++/18984 + * cp-gimplify.c (cp_genericize_r): Don't insert first but instead + check to see if contains the pointer. Insert the statement before + returning. + 2004-12-21 Nathan Sidwell <nathan@codesourcery.com> PR c++/14075 diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 4f38739..d953156 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -291,7 +291,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) } /* Other than invisiref parms, don't walk the same tree twice. */ - if (pointer_set_insert (p_set, stmt)) + if (pointer_set_contains (p_set, stmt)) { *walk_subtrees = 0; return NULL_TREE; @@ -315,14 +315,13 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) to lower this construct before scanning it, so we need to lower these before doing anything else. */ else if (TREE_CODE (stmt) == CLEANUP_STMT) - { - *stmt_p = build2 (CLEANUP_EH_ONLY (stmt) ? TRY_CATCH_EXPR - : TRY_FINALLY_EXPR, - void_type_node, - CLEANUP_BODY (stmt), - CLEANUP_EXPR (stmt)); - pointer_set_insert (p_set, *stmt_p); - } + *stmt_p = build2 (CLEANUP_EH_ONLY (stmt) ? TRY_CATCH_EXPR + : TRY_FINALLY_EXPR, + void_type_node, + CLEANUP_BODY (stmt), + CLEANUP_EXPR (stmt)); + + pointer_set_insert (p_set, *stmt_p); return NULL; } diff --git a/gcc/pointer-set.c b/gcc/pointer-set.c index 3f79cc2..266cccf 100644 --- a/gcc/pointer-set.c +++ b/gcc/pointer-set.c @@ -90,6 +90,29 @@ void pointer_set_destroy (struct pointer_set_t *pset) XDELETE (pset); } +/* Returns nonzero if PSET contains P. P must be nonnull. + + Collisions are resolved by linear probing. */ +int +pointer_set_contains (struct pointer_set_t *pset, void *p) +{ + size_t n = hash1 (p, pset->n_slots, pset->log_slots); + + while (true) + { + if (pset->slots[n] == p) + return 1; + else if (pset->slots[n] == 0) + return 0; + else + { + ++n; + if (n == pset->n_slots) + n = 0; + } + } +} + /* Subroutine of pointer_set_insert. Inserts P into an empty element of SLOTS, an array of length N_SLOTS. Returns nonzero if P was already present in N_SLOTS. */ diff --git a/gcc/pointer-set.h b/gcc/pointer-set.h index 3c2be39..65ac9ee 100644 --- a/gcc/pointer-set.h +++ b/gcc/pointer-set.h @@ -26,6 +26,7 @@ struct pointer_set_t; struct pointer_set_t *pointer_set_create (void); void pointer_set_destroy (struct pointer_set_t *pset); +int pointer_set_contains (struct pointer_set_t *pset, void *p); int pointer_set_insert (struct pointer_set_t *pset, void *p); #endif /* POINTER_SET_H */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 046c528..7d62fc4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-12-21 Andrew Pinski <pinskia@physics.uc.edu> + + PR C++/18984 + * g++.dg/eh/ctor3.C: New test. + 2004-12-21 Eric Botcazou <ebotcazou@libertysurf.fr> * objc.dg/stabs-1.m: Allow section name to be quoted and diff --git a/gcc/testsuite/g++.dg/eh/ctor3.C b/gcc/testsuite/g++.dg/eh/ctor3.C new file mode 100644 index 0000000..378c07e --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/ctor3.C @@ -0,0 +1,18 @@ +// PR C++/18984 +// We just to ICE as we did not add a +// deference to invisible by reference +// variable + +// { dg-do compile } + + +struct Str +{ + Str(const char *chars); + Str& operator=(const char *chars); + virtual operator char*() const; +}; +Str _localName(Str fullname) +{ + return (char*)fullname; +} |