Stricter implicit conversions between vectors, revised patch
Joseph S. Myers
joseph@codesourcery.com
Thu Jan 11 23:17:00 GMT 2007
The vector conversions changes broke the handling of opaque types. These
are always meant to be convertible to/from other types of the same size,
whether or not being lax (see the SPE PIM, which defines an opaque type
and lots of non-opaque types), but not to/from types of different sizes.
This showed up in spe.h failing to compile. (PowerPC is the only target
defining the hook to have opaque types at all.)
I've applied this patch after testing on powerpc-none-linux-gnuspe.
2007-01-11 Joseph Myers <joseph@codesourcery.com>
* c-common.c (vector_types_convertible_p): Treat opaque types as
always convertible if they have the same size, but not otherwise.
Index: gcc/c-common.c
===================================================================
--- gcc/c-common.c (revision 120682)
+++ gcc/c-common.c (working copy)
@@ -1091,15 +1091,19 @@
vector_types_convertible_p (tree t1, tree t2, bool emit_lax_note)
{
static bool emitted_lax_note = false;
- bool convertible_lax =
- targetm.vector_opaque_p (t1)
- || targetm.vector_opaque_p (t2)
- || (tree_int_cst_equal (TYPE_SIZE (t1), TYPE_SIZE (t2))
- && (TREE_CODE (TREE_TYPE (t1)) != REAL_TYPE ||
- TYPE_PRECISION (t1) == TYPE_PRECISION (t2))
- && INTEGRAL_TYPE_P (TREE_TYPE (t1))
- == INTEGRAL_TYPE_P (TREE_TYPE (t2)));
+ bool convertible_lax;
+ if ((targetm.vector_opaque_p (t1) || targetm.vector_opaque_p (t2))
+ && tree_int_cst_equal (TYPE_SIZE (t1), TYPE_SIZE (t2)))
+ return true;
+
+ convertible_lax =
+ (tree_int_cst_equal (TYPE_SIZE (t1), TYPE_SIZE (t2))
+ && (TREE_CODE (TREE_TYPE (t1)) != REAL_TYPE ||
+ TYPE_PRECISION (t1) == TYPE_PRECISION (t2))
+ && (INTEGRAL_TYPE_P (TREE_TYPE (t1))
+ == INTEGRAL_TYPE_P (TREE_TYPE (t2))));
+
if (!convertible_lax || flag_lax_vector_conversions)
return convertible_lax;
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list