https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129147

--- Comment #4 from Drea Pinski <pinskia at gcc dot gnu.org> ---
fold_cond_expr_with_comparison is the problem.

  STRIP_NOPS (arg1);
  STRIP_NOPS (arg2);

      case EQ_EXPR:
      case UNEQ_EXPR:
        tem = fold_convert_loc (loc, arg1_type, arg1);
        return fold_convert_loc (loc, type, negate_expr (tem));

Yes that does the issue in the wrong type.

The match pattern does:
```
 /* A == 0 ? A : -A    same as -A */
 (for cmp (eq uneq)
  (simplify
   (cnd (cmp @0 zerop) @2 (negate@1 @2))
    (if (!HONOR_SIGNED_ZEROS (type)
         && bitwise_equal_p (@0, @2))
     @1))

```

But it could be slightly better here and then it would match using the match
pattern.

Reply via email to