c: ignore initializers for elements of variable-size types [PR93577]

Christophe Lyon christophe.lyon@linaro.org
Tue Mar 10 16:18:19 GMT 2020


On Tue, 10 Mar 2020 at 01:52, Joseph Myers <joseph@codesourcery.com> wrote:
>
> On Mon, 9 Mar 2020, Christophe Lyon wrote:
>
> > Hi Joseph,
> >
> > I've noticed that your patch introduces regressions on aarch64:
> > FAIL: gcc.target/aarch64/sve/acle/general-c/sizeless-1.c
> > -march=armv8.2-a+sve  (test for errors, line 33)
> > we now get
> > /gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/sizeless-1.c:33:44:
> > error: empty scalar initializer
> > while we expect dg-error {initializer element is not constant}
> >
> > FAIL: gcc.target/aarch64/sve/acle/general-c/sizeless-1.c
> > -march=armv8.2-a+sve  (test for errors, line 85)
> > we no longer emit dg-error {empty scalar initializer }
> >
> > FAIL: gcc.target/aarch64/sve/acle/general-c/sizeless-1.c
> > -march=armv8.2-a+sve (test for excess errors)
> > FAIL: gcc.target/aarch64/sve/acle/general-c/sizeless-2.c
> > -march=armv8.2-a+sve  (test for errors, line 85)
> > we no longer emit dg-error {empty scalar initializer }
> >
> > Since the compiler did not ICE before your patch, is that new
> > behaviour expected (and the tests need an update), or is that a
> > problem with the patch?
>
> Where there has already been an error about the type of an initializer,
> it's expected that some other errors about the value of that initializer
> will disappear.  So I think the cases where a previously expected error
> has disappeared are cases where the tests need an update; they already
> expect an error for the type.
>
OK, makes sense.


> That leaves the case where you report that "empty scalar initializer" has
> appeared.  That seems like a bug.  Maybe some SVE case means
> process_init_element is ignoring something in an initializer for an SVE
> type that did not in fact result in the variable-size error from
> digest_init?  Is the "empty scalar initializer" error coming from the
> compound literal on line 33, as opposed to the variable initialized on
> that line?
>
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


> --
> Joseph S. Myers
> joseph@codesourcery.com


More information about the Gcc-patches mailing list