re PR middle-end/33724 (Type checking error with address-of and ref-all pointer type)
2007-10-11 Richard Guenther <rguenther@suse.de> PR middle-end/33724 * tree-cfg.c (one_pointer_to_useless_type_conversion_p): New function. (verify_gimple_expr): Use it to verify pointer-to types for ADDR_EXPRs. * gcc.dg/pr33724.c: New testcase. From-SVN: r129228
This commit is contained in:
parent
31b52b5a21
commit
20dcff2aec
4 changed files with 53 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
2007-10-11 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/33724
|
||||
* tree-cfg.c (one_pointer_to_useless_type_conversion_p): New function.
|
||||
(verify_gimple_expr): Use it to verify pointer-to types for
|
||||
ADDR_EXPRs.
|
||||
|
||||
2007-10-11 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR c/33726
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2007-10-11 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/33724
|
||||
* gcc.dg/pr33724.c: New testcase.
|
||||
|
||||
2007-10-11 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR c/33726
|
||||
|
|
20
gcc/testsuite/gcc.dg/pr33724.c
Normal file
20
gcc/testsuite/gcc.dg/pr33724.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* { dg-do compile } */
|
||||
|
||||
/* We ICEd with type-checking enabled. */
|
||||
|
||||
struct xt_entry_target {
|
||||
char name[1];
|
||||
};
|
||||
struct ipt_entry {
|
||||
unsigned char elems[1];
|
||||
};
|
||||
void match_different(const unsigned char *);
|
||||
int dump_entry(struct xt_entry_target *t)
|
||||
{
|
||||
return __builtin_strcmp (t->name, "");
|
||||
}
|
||||
void is_same(const struct ipt_entry *a)
|
||||
{
|
||||
match_different(a->elems);
|
||||
}
|
||||
|
|
@ -3538,6 +3538,24 @@ verify_gimple_reference (tree expr)
|
|||
return verify_gimple_min_lval (expr);
|
||||
}
|
||||
|
||||
/* Returns true if there is one pointer type in TYPE_POINTER_TO (SRC_OBJ)
|
||||
list of pointer-to types that is trivially convertible to DEST. */
|
||||
|
||||
static bool
|
||||
one_pointer_to_useless_type_conversion_p (tree dest, tree src_obj)
|
||||
{
|
||||
tree src;
|
||||
|
||||
if (!TYPE_POINTER_TO (src_obj))
|
||||
return true;
|
||||
|
||||
for (src = TYPE_POINTER_TO (src_obj); src; src = TYPE_NEXT_PTR_TO (src))
|
||||
if (useless_type_conversion_p (dest, src))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Verify the GIMPLE expression EXPR. Returns true if there is an
|
||||
error, otherwise false. */
|
||||
|
||||
|
@ -3773,14 +3791,11 @@ verify_gimple_expr (tree expr)
|
|||
error ("invalid operand in unary expression");
|
||||
return true;
|
||||
}
|
||||
if (TYPE_POINTER_TO (TREE_TYPE (op))
|
||||
&& !useless_type_conversion_p (type,
|
||||
TYPE_POINTER_TO (TREE_TYPE (op)))
|
||||
if (!one_pointer_to_useless_type_conversion_p (type, TREE_TYPE (op))
|
||||
/* FIXME: a longstanding wart, &a == &a[0]. */
|
||||
&& (TREE_CODE (TREE_TYPE (op)) != ARRAY_TYPE
|
||||
|| (TYPE_POINTER_TO (TREE_TYPE (TREE_TYPE (op)))
|
||||
&& !useless_type_conversion_p (type,
|
||||
TYPE_POINTER_TO (TREE_TYPE (TREE_TYPE (op)))))))
|
||||
|| !one_pointer_to_useless_type_conversion_p (type,
|
||||
TREE_TYPE (TREE_TYPE (op)))))
|
||||
{
|
||||
error ("type mismatch in address expression");
|
||||
debug_generic_stmt (TREE_TYPE (expr));
|
||||
|
|
Loading…
Add table
Reference in a new issue