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
This commit is contained in:
Andrew Pinski 2004-12-21 21:20:02 +00:00 committed by Andrew Pinski
parent 697290b71d
commit af76441ffa
7 changed files with 68 additions and 9 deletions

View File

@ -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.

View File

@ -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

View File

@ -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;
}

View File

@ -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. */

View File

@ -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 */

View File

@ -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

View File

@ -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;
}