On Sat, Jun 08, 2013 at 07:48:27PM +0200, Marc Glisse wrote:
> >+  tt = fold_build2 (EQ_EXPR, boolean_type_node, op1,
> >+                integer_minus_one_node);
> 
> Don't we usually try to have both operands of a comparison of the
> same type?

Will fix.

> >+  t = fold_build2 (EQ_EXPR, boolean_type_node, op0,
> >+               TYPE_MIN_VALUE (TREE_TYPE (op0)));
> 
> I didn't see where this test was restricted to the signed case
> (0u/-1 is well defined)?

Will fix.

> >+  t = fold_build2 (TRUTH_AND_EXPR, boolean_type_node, t, tt);
> >+  tt = build2 (EQ_EXPR, boolean_type_node,
> >+           op1, integer_zero_node);
> 
> Why not fold this one?

Sure, will do.

> Name unsigned_type_for (TREE_TYPE (op1)) and TYPE_PRECISION
> (TREE_TYPE (op0)) that are used several times?

Yeah.

> >@@ -4070,8 +4077,15 @@ cp_build_binary_op (location_t location,
> >     {
> >       enum tree_code tcode0 = code0, tcode1 = code1;
> >       tree cop1 = fold_non_dependent_expr_sfinae (op1, tf_none);
> >+      cop1 = maybe_constant_value (cop1);
> >
> >-      warn_for_div_by_zero (location, maybe_constant_value (cop1));
> >+      if (!processing_template_decl && tcode0 == INTEGER_TYPE
> >+          && (TREE_CODE (cop1) != INTEGER_CST
> >+              || integer_zerop (cop1)
> >+              || integer_minus_onep (cop1)))
> >+        doing_div_or_mod = true;
> 
> Aren't you already doing this test in ubsan_instrument_division?

Yep, I'll throw it out of cp/typeck.c.

Thanks for the review!

        Marek

Reply via email to