2011/5/13 Richard Guenther <richard.guent...@gmail.com>: > On Fri, May 13, 2011 at 1:31 PM, Kai Tietz <ktiet...@googlemail.com> wrote: >> Hello, >> >> this patch adds a check to >> >> ChangeLog >> >> 2011-05-13 Kai Tietz >> >> * gimplify.c (gimplify_expr): Make sure operand is boolified. >> * tree-cfg.c (verify_gimple_assign_unary): Check for boolean >> compatible type >> for TRUTH_NOT_EXPR. >> >> Bootstrapped for x86_64-pc-linux-gnu (multilib). Ok for apply? > > Ok with .... > >> Index: tree-cfg.c >> =================================================================== >> --- tree-cfg.c (revision 173725) >> +++ tree-cfg.c (working copy) >> @@ -3342,6 +3342,14 @@ >> return false; >> >> case TRUTH_NOT_EXPR: >> + if (!useless_type_conversion_p (boolean_type_node, rhs1_type) >> + || !useless_type_conversion_p (boolean_type_node, lhs_type)) > > the 2nd check removed, it's redundant with the common check below > > /* For the remaining codes assert there is no conversion involved. */ > if (!useless_type_conversion_p (lhs_type, rhs1_type)) > { > error ("non-trivial conversion in unary operation"); > debug_generic_expr (lhs_type); > debug_generic_expr (rhs1_type); > return true; > } > > and ... > >> + { >> + error ("invalid types in truth not"); >> + debug_generic_expr (lhs_type); >> + debug_generic_expr (rhs1_type); >> + return true; >> + } > > please do not fall through here but add a break. > > Richard. > >> case NEGATE_EXPR: >> case ABS_EXPR: >> case BIT_NOT_EXPR: >> >> Index: gimplify.c >> =================================================================== >> --- gimplify.c (revision 173726) >> +++ gimplify.c (working copy) >> @@ -6754,14 +6754,18 @@ >> } >> >> case TRUTH_NOT_EXPR: >> - if (TREE_TYPE (*expr_p) != boolean_type_node) >> - { >> - tree type = TREE_TYPE (*expr_p); >> - *expr_p = fold_convert (type, gimple_boolify (*expr_p)); >> - ret = GS_OK; >> - break; >> - } >> + { >> + tree org_type = TREE_TYPE (*expr_p); >> >> + *expr_p = gimple_boolify (*expr_p); >> + if (org_type != boolean_type_node) >> + { >> + *expr_p = fold_convert (org_type, *expr_p); >> + ret = GS_OK; >> + break; >> + } >> + } >> + >> ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, >> is_gimple_val, fb_rvalue); >> recalculate_side_effects (*expr_p); >> >
Committed at revision 173732 with your suggested adjustments. Thanks, Kai