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

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot 
gnu.org
            Summary|Segmentation Fault on short |Segmentation Fault on short
                   |initialised with complex    |initialised with complex
                   |arithmetic                  |arithmetic since r17-265

--- Comment #7 from Drea Pinski <pinskia at gcc dot gnu.org> ---
I think I know what caused it and why.


fold changes will change a*cond into (cond?a:1) and then we have b|(cond?a:1)
which fold_binary_op_with_conditional_arg changes into `(cond?b|a:b)`
And then we have this pattern:

/* PR123967: if (cond) A | CST1 : A & ~CST1

   Make both bitops unconditional: (A & ~CST1) | (cond * CST1).  */
(for cmp (simple_comparison)
 (simplify
  (cond (cmp@4 @5 @6) (bit_ior @0 INTEGER_CST@1) (bit_and@3 @0 INTEGER_CST@2))
   (if (INTEGRAL_TYPE_P (type)
        && INTEGRAL_TYPE_P (TREE_TYPE (@0))
        && (TYPE_UNSIGNED (TREE_TYPE (@1)) || tree_int_cst_sgn (@1) > 0)
        && TYPE_PRECISION (type) <= BITS_PER_WORD
        && wi::to_wide (@1) == ~wi::to_wide (@2))
    (bit_ior @3 (mult (convert:type @4) (convert:type @1))))))

Which then turns it into `(A & ~CST1) | (cond * CST1)` and repeat again.

r17-265-gf6f33ca83cb6b8

Reply via email to