On Tue, 10 Mar 2020, Christophe Lyon wrote:

> sizeless-1.c and sizeless-2.c have the same code, but the latter is
> compiled with -msve-vector-bits=256 and expects different
> warnings/errors.
> For line 33:
> svint8_t *invalid_sve_sc_ptr = &(svint8_t) { *global_sve_sc_ptr };
> we now have:
> sizeless-1.c:33:44: error: empty scalar initializer
> sizeless-1.c:33:44: note: (near initialization for '(anonymous)')
> and
> sizeless-2.c:33:44: error: initializer element is not constant
> sizeless-2.c:33:44: note: (near initialization for 'invalid_sve_sc_ptr')
> sizeless-2.c:33:44: error: SVE type 'svint8_t' does not have a fixed size
> so I think the error comes from the compound literal being treated
> differently with -msve-vector-bits=256

I think the sizeless-2.c diagnostics are correct while there's a problem 
in the sizeless-1.c case (the initializer is not empty, so it should not 
be diagnosed as such).

Does the process_init_element code

  /* Ignore elements of an initializer for a variable-size type.
     Those are diagnosed in digest_init.  */
  if (COMPLETE_TYPE_P (constructor_type)
      && TREE_CODE (TYPE_SIZE (constructor_type)) != INTEGER_CST)
    return;

fire for the sizeless-1.c case?  If so, maybe it needs to be restricted in 
some way to apply only to variable size structs / unions / arrays rather 
than whatever kind of variable-size type the SVE types are.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to