[PATCH] constrain one character optimization to one character stores (PR 90989)

Jakub Jelinek jakub@redhat.com
Thu Jun 27 17:04:00 GMT 2019


On Thu, Jun 27, 2019 at 10:58:25AM -0600, Martin Sebor wrote:
> The LHS is unsigned short so handle_char_store would not be called
> because of the check in the caller.  You would need something like:
> 
>   MEM <char[2]> [(char *)&x] = { 'a', 'b' };

This is invalid, because the rhs is non-empty CONSTRUCTOR that doesn't have
VECTOR_TYPE - verify_gimple_assign_single has:
    case CONSTRUCTOR:
      if (TREE_CODE (rhs1_type) == VECTOR_TYPE)
...
      else if (CONSTRUCTOR_NELTS (rhs1) != 0)
        {
          error ("non-vector %qs with elements", code_name);
          debug_generic_stmt (rhs1);
          return true;
        }

But
  MEM <char[2]> [(char *)&x] = MEM <char[2]> [(char *)"ab"];
is valid.  Or = {} would be valid too, even for array stores.

	Jakub



More information about the Gcc-patches mailing list