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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Sandiford <rsand...@gcc.gnu.org>:

https://gcc.gnu.org/g:7d599ad27b9bcf5165f87710f1abc64bbabd06ae

commit r11-2481-g7d599ad27b9bcf5165f87710f1abc64bbabd06ae
Author: Richard Sandiford <richard.sandif...@arm.com>
Date:   Sat Aug 1 12:41:28 2020 +0100

    c: Fix bogus vector initialisation error [PR96377]

    One of the problems in this PR was that if we had:

      vector_type1 array[] = { vector_value1 };

    process_init_element would only treat vector_value1 as initialising
    a vector_type1 if they had the same TYPE_MAIN_VARIANT.  This has
    several problems:

    (1) It gives confusing error messages if the vector types are
        incompatible.  (Tested by gcc.dg/pr96377-1.c.)

    (2) It means that we reject code that should be valid with
        -flax-vector-conversions.  (Tested by gcc.dg/pr96377-2.c.)

    (3) On arm and aarch64 targets, it means that we reject some
        initializers that mix Advanced SIMD and standard GNU vectors.
        These vectors have traditionally had different TYPE_MAIN_VARIANTs
        because they have different mangling schemes.  (Tested by
        gcc.dg/pr96377-[3-6].c.)

    (4) It means that we reject SVE initializers that should be valid.
        (Tested by gcc.target/aarch64/sve/gnu_vectors_[34].c.)

    (5) After r11-1741-g:31427b974ed7b7dd54e2 we reject:

          arm_neon_type1 array[] = { k ^ arm_neon_value1 };

        because applying the binary operator to arm_neon_value1 strips
        the "Advanced SIMD type" attributes that were added in that patch.
        Stripping the attributes is problematic for other reasons though,
        so that still needs to be fixed separately.

    g++.target/aarch64/sve/gnu_vectors_[34].C already pass.

    gcc/c/
            PR c/96377
            * c-typeck.c (process_init_element): Split test for whether to
            recurse into a record, union or array into...
            (initialize_elementwise_p): ...this new function.  Don't recurse
            into a vector type if the initialization value is also a vector.

    gcc/testsuite/
            PR c/96377
            * gcc.dg/pr96377-1.c: New test.
            * gcc.dg/pr96377-2.c: Likewise.
            * gcc.dg/pr96377-3.c: Likewise.
            * gcc.dg/pr96377-4.c: Likewise.
            * gcc.dg/pr96377-5.c: Likewise.
            * gcc.dg/pr96377-6.c: Likewise.
            * gcc.target/aarch64/pr96377-1.c: Likewise.
            * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c: Likewise.
            * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c: Likewise.
            * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C:
Likewise.
            * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C:
Likewise.

Reply via email to