PREDICT_EXPR causes segfault in tree_could_trap_p
Richard Guenther
richard.guenther@gmail.com
Wed Jun 11 10:10:00 GMT 2008
On Wed, Jun 11, 2008 at 11:49 AM, Andrew Haley <aph@redhat.com> wrote:
> 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?
IMHO PREDICT_EXPR should be in tcc_expression instead, or get
a proper type.
Richard.
> 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