Commit af76441f by Andrew Pinski Committed by Andrew Pinski

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
parent 697290b7
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> 2004-12-21 Richard Henderson <rth@redhat.com>
* gimplify.c (eval_save_expr): New. * gimplify.c (eval_save_expr): New.
......
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> 2004-12-21 Nathan Sidwell <nathan@codesourcery.com>
PR c++/14075 PR c++/14075
......
...@@ -291,7 +291,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) ...@@ -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. */ /* 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; *walk_subtrees = 0;
return NULL_TREE; return NULL_TREE;
...@@ -315,14 +315,13 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) ...@@ -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 to lower this construct before scanning it, so we need to lower these
before doing anything else. */ before doing anything else. */
else if (TREE_CODE (stmt) == CLEANUP_STMT) else if (TREE_CODE (stmt) == CLEANUP_STMT)
{ *stmt_p = build2 (CLEANUP_EH_ONLY (stmt) ? TRY_CATCH_EXPR
*stmt_p = build2 (CLEANUP_EH_ONLY (stmt) ? TRY_CATCH_EXPR : TRY_FINALLY_EXPR,
: TRY_FINALLY_EXPR, void_type_node,
void_type_node, CLEANUP_BODY (stmt),
CLEANUP_BODY (stmt), CLEANUP_EXPR (stmt));
CLEANUP_EXPR (stmt));
pointer_set_insert (p_set, *stmt_p); pointer_set_insert (p_set, *stmt_p);
}
return NULL; return NULL;
} }
......
...@@ -90,6 +90,29 @@ void pointer_set_destroy (struct pointer_set_t *pset) ...@@ -90,6 +90,29 @@ void pointer_set_destroy (struct pointer_set_t *pset)
XDELETE (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 /* Subroutine of pointer_set_insert. Inserts P into an empty
element of SLOTS, an array of length N_SLOTS. Returns nonzero element of SLOTS, an array of length N_SLOTS. Returns nonzero
if P was already present in N_SLOTS. */ if P was already present in N_SLOTS. */
......
...@@ -26,6 +26,7 @@ struct pointer_set_t; ...@@ -26,6 +26,7 @@ struct pointer_set_t;
struct pointer_set_t *pointer_set_create (void); struct pointer_set_t *pointer_set_create (void);
void pointer_set_destroy (struct pointer_set_t *pset); 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); int pointer_set_insert (struct pointer_set_t *pset, void *p);
#endif /* POINTER_SET_H */ #endif /* POINTER_SET_H */
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> 2004-12-21 Eric Botcazou <ebotcazou@libertysurf.fr>
* objc.dg/stabs-1.m: Allow section name to be quoted and * objc.dg/stabs-1.m: Allow section name to be quoted and
......
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment