+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>
PR rtl-optimization/33653
--- /dev/null
+/* 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));
+}
return true;
}
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 (sizetype, TREE_TYPE (op1)))
{
}
}
-/* 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
-verify_gimple_1 (tree stmts)
+static bool
+verify_gimple_2 (tree stmts)
{
tree_stmt_iterator tsi;
+ bool err = false;
for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
{
switch (TREE_CODE (stmt))
{
case BIND_EXPR:
- verify_gimple_1 (BIND_EXPR_BODY (stmt));
+ err |= verify_gimple_2 (BIND_EXPR_BODY (stmt));
break;
case TRY_CATCH_EXPR:
case TRY_FINALLY_EXPR:
- verify_gimple_1 (TREE_OPERAND (stmt, 0));
- verify_gimple_1 (TREE_OPERAND (stmt, 1));
+ err |= verify_gimple_2 (TREE_OPERAND (stmt, 0));
+ err |= verify_gimple_2 (TREE_OPERAND (stmt, 1));
break;
case CATCH_EXPR:
- verify_gimple_1 (CATCH_BODY (stmt));
+ err |= verify_gimple_2 (CATCH_BODY (stmt));
break;
case EH_FILTER_EXPR:
- verify_gimple_1 (EH_FILTER_FAILURE (stmt));
+ err |= verify_gimple_2 (EH_FILTER_FAILURE (stmt));
break;
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. */