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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
             Blocks|                            |105140
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-04-13
                 CC|                            |rsandifo at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  Now that fold_convertible_p doesn't ICE it's still inconsistent in
what fold_convert does.  fold_convertible_p:

    case VECTOR_TYPE:
      return (VECTOR_TYPE_P (orig)
              && known_eq (TYPE_VECTOR_SUBPARTS (type),
                           TYPE_VECTOR_SUBPARTS (orig))
              && fold_convertible_p (TREE_TYPE (type), TREE_TYPE (orig)));

thus it allows promotion/demotion of elements, while fold_convert:

    case VECTOR_TYPE:
      if (integer_zerop (arg))
        return build_zero_vector (type);
      gcc_assert (tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)));
      gcc_assert (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig)
                  || TREE_CODE (orig) == VECTOR_TYPE);
      return fold_build1_loc (loc, VIEW_CONVERT_EXPR, type, arg);

IIRC Richard originally enhanced fold_convertible_p in r10-5112-gfddcfa5b84bf8a
but it seems that the check didn't really intend to allow the vector
conversions
now possible with NOP_EXPRs but were to prevent IPA-CP from generating invalid
conversions.

So I guess we should simply sync fold_convert and fold_convertible_p here.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105140
[Bug 105140] [10/11 Regression] ICE: SIGSEGV in fold_convertible_p with
conflicting function redeclaration since r10-5112-gfddcfa5b84bf8a06

Reply via email to