Commit 7dc83ebc by Richard Guenther Committed by Richard Biener

re PR middle-end/33641 (perlbmk gets type mismatch in pointer plus expression)

2007-10-04  Richard Guenther  <rguenther@suse.de>

	PR middle-end/33641
	* tree-cfg.c (verify_gimple_expr): Operand one of POINTER_PLUS_EXPR
	does not need to be of INTEGER_TYPE.
	(verify_gimple_2): New function split out from ...
	(verify_gimple_1): ... here.  ICE if there was an error during
	verification.

	* gcc.c-torture/compile/pr33641.c: New testcase.

From-SVN: r129010
parent fa33a305
2007-10-04 Richard Guenther <rguenther@suse.de>
PR middle-end/33641
* tree-cfg.c (verify_gimple_expr): Operand one of POINTER_PLUS_EXPR
does not need to be of INTEGER_TYPE.
(verify_gimple_2): New function split out from ...
(verify_gimple_1): ... here. ICE if there was an error during
verification.
2007-10-04 Michael Matz <matz@suse.de> 2007-10-04 Michael Matz <matz@suse.de>
PR rtl-optimization/33653 PR rtl-optimization/33653
2007-10-04 Richard Guenther <rguenther@suse.de>
PR middle-end/33641
* gcc.c-torture/compile/pr33641.c: New testcase.
2007-10-04 Michael Matz <matz@suse.de> 2007-10-04 Michael Matz <matz@suse.de>
PR rtl-optimization/33653 PR rtl-optimization/33653
/* This failed with type checking enabled. */
typedef enum { one, two } exp;
extern exp pe;
extern char pt[256];
void psd (void (*f) (void *), void *p);
static void rle (void *e) { }
void
foo (void)
{
psd ((void (*)(void *)) (rle), (void *) (pt + pe));
}
...@@ -3724,7 +3724,6 @@ verify_gimple_expr (tree expr) ...@@ -3724,7 +3724,6 @@ verify_gimple_expr (tree expr)
return true; return true;
} }
if (!POINTER_TYPE_P (TREE_TYPE (op0)) if (!POINTER_TYPE_P (TREE_TYPE (op0))
|| TREE_CODE (TREE_TYPE (op1)) != INTEGER_TYPE
|| !useless_type_conversion_p (type, TREE_TYPE (op0)) || !useless_type_conversion_p (type, TREE_TYPE (op0))
|| !useless_type_conversion_p (sizetype, TREE_TYPE (op1))) || !useless_type_conversion_p (sizetype, TREE_TYPE (op1)))
{ {
...@@ -4023,12 +4022,14 @@ verify_gimple_stmt (tree stmt) ...@@ -4023,12 +4022,14 @@ verify_gimple_stmt (tree stmt)
} }
} }
/* Verify the GIMPLE statements inside the statement list STMTS. */ /* Verify the GIMPLE statements inside the statement list STMTS.
Returns true if there were any errors. */
void static bool
verify_gimple_1 (tree stmts) verify_gimple_2 (tree stmts)
{ {
tree_stmt_iterator tsi; tree_stmt_iterator tsi;
bool err = false;
for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi)) for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
{ {
...@@ -4037,28 +4038,44 @@ verify_gimple_1 (tree stmts) ...@@ -4037,28 +4038,44 @@ verify_gimple_1 (tree stmts)
switch (TREE_CODE (stmt)) switch (TREE_CODE (stmt))
{ {
case BIND_EXPR: case BIND_EXPR:
verify_gimple_1 (BIND_EXPR_BODY (stmt)); err |= verify_gimple_2 (BIND_EXPR_BODY (stmt));
break; break;
case TRY_CATCH_EXPR: case TRY_CATCH_EXPR:
case TRY_FINALLY_EXPR: case TRY_FINALLY_EXPR:
verify_gimple_1 (TREE_OPERAND (stmt, 0)); err |= verify_gimple_2 (TREE_OPERAND (stmt, 0));
verify_gimple_1 (TREE_OPERAND (stmt, 1)); err |= verify_gimple_2 (TREE_OPERAND (stmt, 1));
break; break;
case CATCH_EXPR: case CATCH_EXPR:
verify_gimple_1 (CATCH_BODY (stmt)); err |= verify_gimple_2 (CATCH_BODY (stmt));
break; break;
case EH_FILTER_EXPR: case EH_FILTER_EXPR:
verify_gimple_1 (EH_FILTER_FAILURE (stmt)); err |= verify_gimple_2 (EH_FILTER_FAILURE (stmt));
break; break;
default: default:
if (verify_gimple_stmt (stmt)) {
debug_generic_expr (stmt); bool err2 = verify_gimple_stmt (stmt);
if (err2)
debug_generic_expr (stmt);
err |= err2;
}
} }
} }
return err;
}
/* Verify the GIMPLE statements inside the statement list STMTS. */
void
verify_gimple_1 (tree stmts)
{
if (verify_gimple_2 (stmts))
internal_error ("verify_gimple failed");
} }
/* Verify the GIMPLE statements inside the current function. */ /* Verify the GIMPLE statements inside the current function. */
......
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