PREDICT_EXPR causes segfault in tree_could_trap_p
Andrew Haley
aph@redhat.com
Wed Jun 11 09:50:00 GMT 2008
PREDICT_EXPR is in class tcc_unary but has TREE_TYPE == NULL_TREE.
This causes a segfault in tree_could_trap_p(). The simplest way
to fix this is to check for NULL_TREE.
OK for trunk & branch?
Andrew.
2008-06-11 Andrew Haley <aph@redhat.com>
* tree-eh.c (tree_could_trap_p): Guard against null TREE_TYPE in expr.
Index: tree-eh.c
===================================================================
*** tree-eh.c (revision 135765)
--- tree-eh.c (working copy)
***************
*** 1896,1912 ****
|| TREE_CODE_CLASS (code) == tcc_binary)
{
t = TREE_TYPE (expr);
! if (COMPARISON_CLASS_P (expr))
! fp_operation = FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0)));
! else
! fp_operation = FLOAT_TYPE_P (t);
! if (fp_operation)
{
! honor_nans = flag_trapping_math && !flag_finite_math_only;
! honor_snans = flag_signaling_nans != 0;
}
- else if (INTEGRAL_TYPE_P (t) && TYPE_OVERFLOW_TRAPS (t))
- honor_trapv = true;
}
restart:
--- 1896,1916 ----
|| TREE_CODE_CLASS (code) == tcc_binary)
{
t = TREE_TYPE (expr);
! if (t != NULL_TREE)
! /* PREDICT_EXPR is unary but has no TREE_TYPE. */
{
! if (COMPARISON_CLASS_P (expr))
! fp_operation = FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0)));
! else
! fp_operation = FLOAT_TYPE_P (t);
! if (fp_operation)
! {
! honor_nans = flag_trapping_math && !flag_finite_math_only;
! honor_snans = flag_signaling_nans != 0;
! }
! else if (INTEGRAL_TYPE_P (t) && TYPE_OVERFLOW_TRAPS (t))
! honor_trapv = true;
}
}
restart:
More information about the Gcc-patches
mailing list