Stricter implicit conversions between vectors, revised patch

Mark Mitchell mark@codesourcery.com
Wed Jan 3 22:17:00 GMT 2007


Mark Shinwell wrote:

> 2006-12-23  Mark Shinwell  <shinwell@codesourcery.com>
> 
>         gcc/
>         * c.opt: Add -flax-vector-conversions.
>         * c-typeck.c (convert_for_assignment): Pass flag to
>         vector_types_convertible_p to allow emission of note.
>         (digest_init): Likewise.
>         * c-opts.c: Handle -flax-vector-conversions.
>         * c-common.c (flag_lax_vector_conversions): New.
>         (vector_types_convertible_p): Unless -flax-vector conversions
>         has been passed, disallow conversions between vectors with
>         differing numbers of subparts and/or element types.  If such
>         a conversion is disallowed, possibly emit a note on the first
>         occasion only to inform the user of -flax-vector-conversions.
>         The new last argument specifies this.
>         * c-common.h (flag_lax_vector_conversions): New.
>         (vector_types_convertible_p): Add extra argument.
>         * config/i386/i386.c (ix86_init_mmx_sse_builtins): Use
>         char_type_node for V*QI type vectors.
>         * config/rs6000/rs6000-c.c (altivec_overloaded_builtins):
>         Update to satisfy new typechecking rules.
>         * config/rs6000/altivec.h (vec_cmple): Use vec_cmpge, for both
>     C and C++ variants.
>         * doc/invoke.texi (C Dialect Options): Document
>         -flax-vector-conversions.
> 
>         gcc/cp/
>         * call.c (standard_conversion): Pass flag to
>         vector_types_convertible_p to disallow emission of note.
>         * typeck.c (convert_for_assignment): Pass flag to
>         vector_types_convertible_p to allow emission of note.
>         (ptr_reasonably_similar): Pass flag to vector_types_convertible_p
>         to disallow emission of note.
> 
>         gcc/testsuite/
>         * gcc.target/i386/20020531-1.c: Use "char" not "unsigned char"
>         in __v8qi typedef.
>         * gcc.target/powerpc/altivec-vec-merge.c (foo): Add casts.
>         * gcc.dg/simd-1.c: Update dg-error directives to reflect new
>         compiler behaviour.
>         * gcc.dg/simd-5.c: Likewise.
>         * gcc.dg/simd-6.c: Likewise.
>         * g++.dg/conversion/simd1.C: Likewise.
>         * g++.dg/conversion/simd3.C: Likewise.
>         * g++.dg/ext/attribute-test-2.C (data): Add "vs" member.
>         (main): Use it.

OK, thanks.  Please be on the lookout for reports of failures on
architectures that you didn't test; there may be other tests lurking
that need editing to conform to the new rules.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list