[Bug middle-end/84834] [7/8 Regression] ICE: tree check: expected integer_cst, have complex_cst in to_wide, at tree.h:5527

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 12 18:11:00 GMT 2018


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
          Component|c                           |middle-end

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

/* If we have A < 0 ? C : 0 where C is a power of 2, convert
   this into a right shift or sign extension followed by ANDing with C.  */
(simplify
 (cond
  (lt @0 integer_zerop)
  integer_pow2p@1 integer_zerop)
 (if (!TYPE_UNSIGNED (TREE_TYPE (@0)))
  (with {
    int shift = element_precision (@0) - wi::exact_log2 (wi::to_wide (@1)) - 1;
   }

wi:: only works for INTEGER_CSTs but integer_pow2p also returns nonzero
for _Complex numbers (unexpectedly).  The easiest fix is probably to
add a INTEGRAL_TYPE_P () check.


More information about the Gcc-bugs mailing list