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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
        bool is_char_store = is_char_type (type);
        if (!is_char_store && TREE_CODE (lhs) == MEM_REF)
          {
            /* To consider stores into char objects via integer types
               other than char but not those to non-character objects,
               determine the type of the destination rather than just
               the type of the access.  */
            for (int i = 0; i != 2; ++i)
              {
                tree ref = TREE_OPERAND (lhs, i);
                type = TREE_TYPE (ref);
                if (TREE_CODE (type) == POINTER_TYPE)
                  type = TREE_TYPE (type);
                if (TREE_CODE (type) == ARRAY_TYPE)
                  type = TREE_TYPE (type);
                if (is_char_type (type))
                  {
                    is_char_store = true;
                    break;
                  }
              }
          }
is completely bogus.  With pointer conversions being useless, the type of the
MEM_REF's first operand means nothing at all and the type of second MEM_REF
operand is for alias analysis, again nothing that should matter for how the
strlen pass optimizes code.

Reply via email to