On 3/19/07, Andrew Haley <[EMAIL PROTECTED]> wrote:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31264
This happens because we have a VIEW_CONVERT EXPR(double->long) that is
used in a conditional. VRP tries to register an edge assertion for
this expression:
<view_convert_expr 0x2aaaae08c6c0
type <integer_type 0x2aaaadfee3c0 long public DI
size <integer_cst 0x2aaaadfe19f0 constant invariant 64>
unit size <integer_cst 0x2aaaadfe1a20 constant invariant 8>
align 64 symtab 0 alias set -1 canonical type 0x2aaaadfee3c0 precision 64 min
<integer_cst 0x2aaaadfe1930 -9223372036854775808> max <integer_cst 0x2aaaadfe1990
9223372036854775807>
pointer_to_this <pointer_type 0x2aaaae00e300> chain <type_decl 0x2aaaadff2270
long>>
arg 0 <ssa_name 0x2aaaae0a8f00
type <real_type 0x2aaaadffa6c0 double DF size <integer_cst 0x2aaaadfe19f0 64>
unit size <integer_cst 0x2aaaadfe1a20 8>
align 64 symtab 0 alias set -1 canonical type 0x2aaaadffa6c0
precision 64
chain <type_decl 0x2aaaadff2d00 double>>
visited var <parm_decl 0x2aaaadfe7960 D.774> def_stmt <phi_node
0x2aaaae0b2d00>
Which eventually works its way down to:
if (!has_single_use (op))
{
val = build_int_cst (TREE_TYPE (op), 0);
register_new_assert_for (op, code, val, NULL, e, bsi);
retval = true;
}
and this fails with an ICE because TREE_TYPE (op) is real_type, and
you can't build_int_cst with a real_type.
The simplest way of fixing this is simply to disallow
VIEW_CONVERT_EXPR in this context. Comments?
Index: tree-vrp.c
===================================================================
--- tree-vrp.c (revision 122839)
+++ tree-vrp.c (working copy)
@@ -3485,7 +3485,6 @@
}
else if (TREE_CODE (rhs) == NOP_EXPR
|| TREE_CODE (rhs) == CONVERT_EXPR
- || TREE_CODE (rhs) == VIEW_CONVERT_EXPR
|| TREE_CODE (rhs) == NON_LVALUE_EXPR)
{
/* Recurse through the type conversion. */
It's indeed broken to look through VIEW_CONVERT_EXPRs here. The patch looks
obviously correct.
Thanks,
Richard.